ysharma HF Staff commited on
Commit
aad9869
·
1 Parent(s): 8db22bd
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -8,12 +8,12 @@ demo_inf_ofa = gr.Interface.load(name="spaces/ICML2022/OFA") #"spaces/freddyabou
8
 
9
  #assert demo_inf("Foo", "bar") == "Foo bar"
10
 
11
- def get_ofa(img):
12
  Img = cv2.imread(img)
13
- txt = "Visual Grounding"
14
  print(f"text is :{txt}") #= cv2.imread(img2) #Image.open(img2)
15
  img_pil = Image.fromarray(Img)
16
- img, dummy_txt = gr.Interface.load(name="spaces/ICML2022/OFA")(img, txt)
17
  return img
18
 
19
 
@@ -70,7 +70,8 @@ with demo:
70
 
71
  #with gr.Row():
72
  in_image_ofa = gr.Image(type='filepath') #(visible=False) type='numpy'
73
- #in_txt_ofa = "Visual Grounding"
 
74
  out_image_ofa = gr.outputs.Image(type='file') #(type='file')
75
 
76
  #in_text1 = gr.Textbox()
@@ -80,6 +81,6 @@ with demo:
80
  b2 = gr.Button("Image Button OFA")
81
  #b2 = gr.Button("Text Button")
82
 
83
- b2.click(get_ofa,inputs=in_image_ofa, outputs=out_image_ofa)
84
 
85
  demo.launch(enable_queue=True, debug=True)
 
8
 
9
  #assert demo_inf("Foo", "bar") == "Foo bar"
10
 
11
+ def get_ofa(img, txt, ques):
12
  Img = cv2.imread(img)
13
+ #txt = "Visual Grounding"
14
  print(f"text is :{txt}") #= cv2.imread(img2) #Image.open(img2)
15
  img_pil = Image.fromarray(Img)
16
+ img, dummy_txt = gr.Interface.load(name="spaces/ICML2022/OFA")(img, txt, ques)
17
  return img
18
 
19
 
 
70
 
71
  #with gr.Row():
72
  in_image_ofa = gr.Image(type='filepath') #(visible=False) type='numpy'
73
+ in_txt_ofa = "Visual Grounding"
74
+ in_txt_ofa_ques = gr.Textbox()
75
  out_image_ofa = gr.outputs.Image(type='file') #(type='file')
76
 
77
  #in_text1 = gr.Textbox()
 
81
  b2 = gr.Button("Image Button OFA")
82
  #b2 = gr.Button("Text Button")
83
 
84
+ b2.click(get_ofa,inputs=[in_image_ofa, in_txt_ofa, in_txt_ofa_ques], outputs=out_image_ofa)
85
 
86
  demo.launch(enable_queue=True, debug=True)