theArijitDas commited on
Commit
5fbaaf1
1 Parent(s): ef01d24

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -4,8 +4,15 @@ import gradio as gr
4
  update_validator = Update_Validator(text_model="DistilRoBERTa-v1", image_model="CLIP-ViT Base", threshold=0.75)
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"),
@@ -18,4 +25,13 @@ inputs = [
18
  outputs = [
19
  gr.Number(label="Similarity Score"),
20
  gr.Textbox(label="Update Label")
21
- ]
 
 
 
 
 
 
 
 
 
 
4
  update_validator = Update_Validator(text_model="DistilRoBERTa-v1", image_model="CLIP-ViT Base", threshold=0.75)
5
 
6
  def gradio_interface(text1, image1, text2, image2, threshold=0.75):
7
+ out = update_validator.validate(
8
+ text1=text1,
9
+ image1=image1,
10
+ text2=text2,
11
+ image2=image2,
12
+ threshold=threshold,
13
+ return_score=True
14
+ )
15
+ return out['score'], "Valid" if out['label'] else "Invalid"
16
 
17
  inputs = [
18
  gr.Textbox(lines=5, label="Description 1"),
 
25
  outputs = [
26
  gr.Number(label="Similarity Score"),
27
  gr.Textbox(label="Update Label")
28
+ ]
29
+
30
+ iface = gr.Interface(
31
+ fn=gradio_interface,
32
+ inputs=inputs,
33
+ outputs=outputs,
34
+ title="Product Update Validator"
35
+ )
36
+
37
+ iface.launch()