from product_update_validator import Update_Validator import gradio as gr update_validator = Update_Validator(text_model="DistilRoBERTa-v1", image_model="CLIP-ViT Base", threshold=0.75) def gradio_interface(text1, image1, text2, image2, threshold=0.75): out = update_validator.validate(text1=text1, image1=image1, text2=text2, image2=image2, threshold=threshold, return_score=True) return out['score'], label['label'] inputs = [ gr.inputs.Textbox(lines=5, label="Description 1"), gr.inputs.Image(label="Image 1"), gr.inputs.Textbox(lines=5, label="Description 2"), gr.inputs.Image(label="Image 2"), gr.inputs.Slider(minimum=0, maximum=1, default=0.75, step=0.01, label="Similarity Threshold") ] outputs = [ gr.outputs.Textbox(label="Similarity Score"), gr.outputs.Textbox(label="Update Label") ] iface = gr.Interface(fn=gradio_interface, inputs=inputs, outputs=outputs, title="Product Update Validator") iface.launch()