Spaces:
Runtime error
Runtime error
chore: lable interface
Browse files
app.py
CHANGED
@@ -23,20 +23,19 @@ examples=[
|
|
23 |
def get_titles(query):
|
24 |
query_embed = model.encode(query)
|
25 |
hits = semantic_search(query_embed, title_embeddings, top_k=5)[0]
|
26 |
-
|
27 |
-
titles = list()
|
28 |
-
|
29 |
for hit in hits:
|
30 |
index = hit["corpus_id"]
|
31 |
selected_title = title_dataset["train"]["title"][index]
|
32 |
-
|
33 |
-
titles
|
34 |
-
return
|
35 |
|
36 |
space = gr.Interface(
|
37 |
fn=get_titles,
|
38 |
inputs=gr.Textbox(label="Input Title"),
|
39 |
-
outputs=gr.Textbox(label="Similar Titles"),
|
|
|
40 |
title=title,
|
41 |
description=description,
|
42 |
examples=examples,
|
|
|
23 |
def get_titles(query):
|
24 |
query_embed = model.encode(query)
|
25 |
hits = semantic_search(query_embed, title_embeddings, top_k=5)[0]
|
26 |
+
titles = dict()
|
|
|
|
|
27 |
for hit in hits:
|
28 |
index = hit["corpus_id"]
|
29 |
selected_title = title_dataset["train"]["title"][index]
|
30 |
+
score = hit["score"]
|
31 |
+
titles[selected_title] = score
|
32 |
+
return titles
|
33 |
|
34 |
space = gr.Interface(
|
35 |
fn=get_titles,
|
36 |
inputs=gr.Textbox(label="Input Title"),
|
37 |
+
# outputs=gr.Textbox(label="Similar Titles"),
|
38 |
+
outputs=gr.Label(num_top_classes=5)
|
39 |
title=title,
|
40 |
description=description,
|
41 |
examples=examples,
|