andito HF staff commited on
Commit
ccd3ca3
1 Parent(s): 8b2d7f4
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -53,7 +53,7 @@ def process_image(image, text_input=None):
53
  image = Image.fromarray(image) # Convert NumPy array to PIL Image
54
  task_prompt = '<DocVQA>'
55
  results = run_example(task_prompt, image, text_input)[task_prompt].replace("<pad>", "")
56
- return results, None
57
 
58
 
59
  css = """
@@ -74,7 +74,6 @@ with gr.Blocks(css=css) as demo:
74
  submit_btn = gr.Button(value="Submit")
75
  with gr.Column():
76
  output_text = gr.Textbox(label="Output Text")
77
- output_img = gr.Image(label="Output Image")
78
 
79
  gr.Examples(
80
  examples=[
@@ -84,12 +83,12 @@ with gr.Blocks(css=css) as demo:
84
  ["image.jpg", "What's the share of Industry Switchers Gained?"]
85
  ],
86
  inputs=[input_img, text_input],
87
- outputs=[output_text, output_img],
88
  fn=process_image,
89
  cache_examples=True,
90
  label='Try examples'
91
  )
92
 
93
- submit_btn.click(process_image, [input_img, text_input], [output_text, output_img])
94
 
95
  demo.launch(debug=True)
 
53
  image = Image.fromarray(image) # Convert NumPy array to PIL Image
54
  task_prompt = '<DocVQA>'
55
  results = run_example(task_prompt, image, text_input)[task_prompt].replace("<pad>", "")
56
+ return results
57
 
58
 
59
  css = """
 
74
  submit_btn = gr.Button(value="Submit")
75
  with gr.Column():
76
  output_text = gr.Textbox(label="Output Text")
 
77
 
78
  gr.Examples(
79
  examples=[
 
83
  ["image.jpg", "What's the share of Industry Switchers Gained?"]
84
  ],
85
  inputs=[input_img, text_input],
86
+ outputs=[output_text],
87
  fn=process_image,
88
  cache_examples=True,
89
  label='Try examples'
90
  )
91
 
92
+ submit_btn.click(process_image, [input_img, text_input], [output_text])
93
 
94
  demo.launch(debug=True)