Spaces:
Build error
Build error
| 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.components.Textbox(lines=5, label="Description 1"), | |
| gr.components.Image(label="Image 1"), | |
| gr.components.Textbox(lines=5, label="Description 2"), | |
| gr.components.Image(label="Image 2"), | |
| gr.components.Slider(minimum=0, maximum=1, value=0.75, step=0.01, label="Similarity Threshold") | |
| ] | |
| outputs = [ | |
| gr.components.Textbox(label="Similarity Score"), | |
| gr.components.Textbox(label="Update Label") | |
| ] | |
| iface = gr.Interface(fn=gradio_interface, inputs=inputs, outputs=outputs, title="Product Update Validator") | |
| iface.launch() |