theArijitDas commited on
Commit
ef01d24
1 Parent(s): 3aca399

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -5,20 +5,17 @@ update_validator = Update_Validator(text_model="DistilRoBERTa-v1", image_model="
5
 
6
  def gradio_interface(text1, image1, text2, image2, threshold=0.75):
7
  out = update_validator.validate(text1=text1, image1=image1, text2=text2, image2=image2, threshold=threshold, return_score=True)
8
- return out['score'], "Valid" if label['label'] else "Invalid"
9
 
10
  inputs = [
11
- gr.components.Textbox(lines=5, label="Description 1"),
12
- gr.components.Image(label="Image 1"),
13
- gr.components.Textbox(lines=5, label="Description 2"),
14
- gr.components.Image(label="Image 2"),
15
- gr.components.Slider(minimum=0, maximum=1, value=0.75, step=0.01, label="Similarity Threshold")
16
  ]
17
 
18
  outputs = [
19
  gr.Number(label="Similarity Score"),
20
  gr.Textbox(label="Update Label")
21
- ]
22
-
23
- iface = gr.Interface(fn=gradio_interface, inputs=inputs, outputs=outputs, title="Product Update Validator")
24
- iface.launch()
 
5
 
6
  def gradio_interface(text1, image1, text2, image2, threshold=0.75):
7
  out = update_validator.validate(text1=text1, image1=image1, text2=text2, image2=image2, threshold=threshold, return_score=True)
8
+ return out['score'], "Valid" if out['label'] else "Invalid"
9
 
10
  inputs = [
11
+ gr.Textbox(lines=5, label="Description 1"),
12
+ gr.Image(type="pil", label="Image 1"),
13
+ gr.Textbox(lines=5, label="Description 2"),
14
+ gr.Image(type="pil", label="Image 2"),
15
+ gr.Slider(minimum=0, maximum=1, value=0.75, step=0.01, label="Similarity Threshold")
16
  ]
17
 
18
  outputs = [
19
  gr.Number(label="Similarity Score"),
20
  gr.Textbox(label="Update Label")
21
+ ]