|
from inference import predict |
|
import gradio as gr |
|
|
|
|
|
def pred(question1, question2, threshold): |
|
|
|
similarity, is_same = predict(question1, question2, threshold, verbose=True) |
|
|
|
return similarity, is_same |
|
|
|
|
|
|
|
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() |