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