qtoino commited on
Commit
9b395d3
Β·
verified Β·
1 Parent(s): 44976d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -58
app.py CHANGED
@@ -51,12 +51,11 @@ css = """
51
  """
52
 
53
  with gr.Blocks(css=css) as demo:
54
- gr.HTML("<h1><center>Pix2Struct πŸ“„<center><h1>")
55
- gr.HTML("<h3><center>Pix2Struct is a powerful backbone for visual question answering. ⚑</h3>")
56
- gr.HTML("<h3><center>Each tab in this app demonstrates Pix2Struct models fine-tuned on document question answering, infographics question answering, question answering on user interfaces, and charts. πŸ“„πŸ“±πŸ“Š<h3>")
57
- gr.HTML("<h3><center>This app has base versions of each model. For better performance, use large checkpoints.<h3>")
58
 
59
- with gr.Tab(label="Visual Question Answering over Documents"):
60
  with gr.Row():
61
  with gr.Column():
62
  input_img = gr.Image(label="Input Document")
@@ -71,59 +70,7 @@ with gr.Blocks(css=css) as demo:
71
  cache_examples=True,
72
  label='Click on any Examples below to get Document Question Answering results quickly πŸ‘‡'
73
  )
74
-
75
  submit_btn.click(infer_doc, [input_img, question], [output])
76
 
77
- with gr.Tab(label="Visual Question Answering over Infographics"):
78
- with gr.Row():
79
- with gr.Column():
80
- input_img = gr.Image(label="Input Image")
81
- question = gr.Text(label="Question")
82
- submit_btn = gr.Button(value="Submit")
83
- output = gr.Text(label="Answer")
84
- gr.Examples(
85
- [["infographics_example.jpeg", "What is this infographic about?"]],
86
- inputs = [input_img, question],
87
- outputs = [output],
88
- fn=infer_doc,
89
- cache_examples=True,
90
- label='Click on any Examples below to get Infographics QA results quickly πŸ‘‡'
91
- )
92
-
93
- submit_btn.click(infer_infographics, [input_img, question], [output])
94
- with gr.Tab(label="Caption User Interfaces"):
95
- with gr.Row():
96
- with gr.Column():
97
- input_img = gr.Image(label="Input UI Image")
98
- question = gr.Text(label="Question")
99
- submit_btn = gr.Button(value="Submit")
100
- output = gr.Text(label="Caption")
101
- submit_btn.click(infer_chart, [input_img, question], [output])
102
- gr.Examples(
103
- [["screen2words_ui_example.png", "What is this UI about?"]],
104
- inputs = [input_img, question],
105
- outputs = [output],
106
- fn=infer_doc,
107
- cache_examples=True,
108
- label='Click on any Examples below to get UI question answering results quickly πŸ‘‡'
109
- )
110
-
111
- with gr.Tab(label="Ask about Charts"):
112
- with gr.Row():
113
- with gr.Column():
114
- input_img = gr.Image(label="Input Chart")
115
- question = gr.Text(label="Question")
116
- submit_btn = gr.Button(value="Submit")
117
- output = gr.Text(label="Caption")
118
-
119
- submit_btn.click(infer_chart, [input_img, question], [output])
120
- gr.Examples(
121
- [["chartqa_example.png", "How much percent is bicycle?"]],
122
- inputs = [input_img, question],
123
- outputs = [output],
124
- fn=infer_doc,
125
- cache_examples=True,
126
- label='Click on any Examples below to get Chart question answering results quickly πŸ‘‡'
127
- )
128
-
129
  demo.launch(debug=True)
 
51
  """
52
 
53
  with gr.Blocks(css=css) as demo:
54
+ gr.HTML("<h1><center>Pix2Struct πŸ“„<center><h1>")
55
+ gr.HTML("<h3><center>Pix2Struct is a powerful backbone for visual question answering. ⚑</h3>")
56
+ gr.HTML("<h3><center>Each tab in this app demonstrates Pix2Struct models fine-tuned on document question answering, infographics question answering, question answering on user interfaces, and charts. πŸ“„πŸ“±πŸ“Š<h3>")
57
+ gr.HTML("<h3><center>This app has base versions of each model. For better performance, use large checkpoints.<h3>")
58
 
 
59
  with gr.Row():
60
  with gr.Column():
61
  input_img = gr.Image(label="Input Document")
 
70
  cache_examples=True,
71
  label='Click on any Examples below to get Document Question Answering results quickly πŸ‘‡'
72
  )
73
+
74
  submit_btn.click(infer_doc, [input_img, question], [output])
75
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  demo.launch(debug=True)