Update app.py
Browse files
app.py
CHANGED
@@ -4,17 +4,17 @@ import gradio as gr
|
|
4 |
# Function to call the FastAPI backend
|
5 |
def predict(question1, question2, threshold):
|
6 |
|
7 |
-
similarity, is_same =
|
8 |
|
9 |
return similarity, is_same
|
10 |
|
11 |
|
12 |
# Launch the Gradio interface
|
13 |
if __name__ == "__main__":
|
14 |
-
gr.Interface(
|
15 |
inputs=[gr.Textbox(placeholder="Is Leonel Messi the Goat ?"),
|
16 |
gr.Textbox(placeholder="Is Leonel Messi the best player ever?"),
|
17 |
gr.Slider(minimum=0.0, maximum=1.0)],
|
18 |
-
outputs=["
|
19 |
description="This app tells us whether the two questions are similar or not"
|
20 |
-
)
|
|
|
4 |
# Function to call the FastAPI backend
|
5 |
def predict(question1, question2, threshold):
|
6 |
|
7 |
+
similarity, is_same = pred(question1, question2, threshold, verbose=True)
|
8 |
|
9 |
return similarity, is_same
|
10 |
|
11 |
|
12 |
# Launch the Gradio interface
|
13 |
if __name__ == "__main__":
|
14 |
+
gr.Interface(pred,
|
15 |
inputs=[gr.Textbox(placeholder="Is Leonel Messi the Goat ?"),
|
16 |
gr.Textbox(placeholder="Is Leonel Messi the best player ever?"),
|
17 |
gr.Slider(minimum=0.0, maximum=1.0)],
|
18 |
+
outputs=[gr.Number(label="Similarity score"), gr.Textbox(label="Is similar?")],
|
19 |
description="This app tells us whether the two questions are similar or not"
|
20 |
+
).launch()
|