Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -32,7 +32,7 @@ def find_most_similar(sentence, candidates, threshold=0.15):
|
|
| 32 |
similar_sentences = []
|
| 33 |
for i, score in enumerate(similarity_scores):
|
| 34 |
if score >= threshold:
|
| 35 |
-
similar_sentences.append({"sentence": candidates[i], "
|
| 36 |
|
| 37 |
return similar_sentences
|
| 38 |
|
|
@@ -51,13 +51,13 @@ def fetch_vectors(file, sentence):
|
|
| 51 |
# Interface
|
| 52 |
file_uploader = gr.File(label="Upload a .txt file")
|
| 53 |
text_input = gr.Textbox(label="Enter a sentence")
|
| 54 |
-
output_text = gr.Textbox(label="
|
| 55 |
|
| 56 |
iface = gr.Interface(
|
| 57 |
fn=fetch_vectors,
|
| 58 |
inputs=[file_uploader, text_input],
|
| 59 |
outputs=output_text,
|
| 60 |
-
title="
|
| 61 |
description="Upload a text file and enter the question. The threshold is set to 0.15."
|
| 62 |
)
|
| 63 |
|
|
|
|
| 32 |
similar_sentences = []
|
| 33 |
for i, score in enumerate(similarity_scores):
|
| 34 |
if score >= threshold:
|
| 35 |
+
similar_sentences.append({"sentence": candidates[i], "f(score)": round(score, 4)})
|
| 36 |
|
| 37 |
return similar_sentences
|
| 38 |
|
|
|
|
| 51 |
# Interface
|
| 52 |
file_uploader = gr.File(label="Upload a .txt file")
|
| 53 |
text_input = gr.Textbox(label="Enter a sentence")
|
| 54 |
+
output_text = gr.Textbox(label="RAG -QA")
|
| 55 |
|
| 56 |
iface = gr.Interface(
|
| 57 |
fn=fetch_vectors,
|
| 58 |
inputs=[file_uploader, text_input],
|
| 59 |
outputs=output_text,
|
| 60 |
+
title="Minimal RAG - For QA (Super Fast/Modeless)",
|
| 61 |
description="Upload a text file and enter the question. The threshold is set to 0.15."
|
| 62 |
)
|
| 63 |
|