Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -21,13 +21,12 @@ sim_model.add_corpus(load_file('corpus.txt'))
|
|
| 21 |
def ai_text(query):
|
| 22 |
res = sim_model.most_similar(queries=query, topn=5)
|
| 23 |
print(res)
|
| 24 |
-
for q_id, c in res
|
| 25 |
-
print('query:',
|
| 26 |
-
print("search top
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
res_show =
|
| 30 |
-
list(res.values())[0].items()])
|
| 31 |
return res_show
|
| 32 |
|
| 33 |
|
|
@@ -44,6 +43,6 @@ if __name__ == '__main__':
|
|
| 44 |
outputs=gr.Textbox(label="Output Box"),
|
| 45 |
title="Chinese Text Semantic Search Model",
|
| 46 |
description="Copy or input Chinese text here. Submit and the machine will find the most similarity texts.",
|
| 47 |
-
article="Link to <a href='https://github.com/shibing624/similarities' style='color:blue;' target='_blank\'>Github REPO</a>",
|
| 48 |
examples=examples
|
| 49 |
).launch()
|
|
|
|
| 21 |
def ai_text(query):
|
| 22 |
res = sim_model.most_similar(queries=query, topn=5)
|
| 23 |
print(res)
|
| 24 |
+
for q_id, c in enumerate(res):
|
| 25 |
+
print('query:', sentences[q_id])
|
| 26 |
+
print("search top 3:")
|
| 27 |
+
print(f'\t{c}')
|
| 28 |
+
|
| 29 |
+
res_show = str(res)
|
|
|
|
| 30 |
return res_show
|
| 31 |
|
| 32 |
|
|
|
|
| 43 |
outputs=gr.Textbox(label="Output Box"),
|
| 44 |
title="Chinese Text Semantic Search Model",
|
| 45 |
description="Copy or input Chinese text here. Submit and the machine will find the most similarity texts.",
|
| 46 |
+
article="Link to <a href='https://github.com/shibing624/similarities' style='color:blue;' target='_blank\'>Github REPO: similarities</a>",
|
| 47 |
examples=examples
|
| 48 |
).launch()
|