fl399 commited on
Commit
73faa4f
1 Parent(s): 1cdf007

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -10,7 +10,7 @@ torch.hub.download_url_to_file('https://raw.githubusercontent.com/vis-nlp/ChartQ
10
  torch.hub.download_url_to_file('https://sharkcoder.com/files/article/matplotlib-bar-plot.png', 'chart_example_4.png')
11
 
12
 
13
- model_name = "google/matcha-chart2text-statista"
14
  model = Pix2StructForConditionalGeneration.from_pretrained(model_name)
15
  processor = Pix2StructProcessor.from_pretrained(model_name)
16
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
@@ -27,10 +27,11 @@ def summarize_chart(image):
27
 
28
  image = gr.inputs.Image(type="pil", label="Chart")
29
  answer = gr.outputs.Textbox(label="Chart Summary")
30
- examples = [["chart_example.png"], ["chart_example_2.png"], ["chart_example_3.png"], ["chart_example_4.png"]]
 
31
 
32
- title = "Interactive demo: chart summarization"
33
- description = "Gradio Demo for matcha model, fine-tuned on chart2text statista, a model that can summarize charts. To use it, simply upload your image and click 'submit', or click one of the examples to load them."
34
 
35
  interface = gr.Interface(fn=summarize_chart,
36
  inputs=[image],
 
10
  torch.hub.download_url_to_file('https://sharkcoder.com/files/article/matplotlib-bar-plot.png', 'chart_example_4.png')
11
 
12
 
13
+ model_name = "google/matcha-chartqa"
14
  model = Pix2StructForConditionalGeneration.from_pretrained(model_name)
15
  processor = Pix2StructProcessor.from_pretrained(model_name)
16
  device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
 
27
 
28
  image = gr.inputs.Image(type="pil", label="Chart")
29
  answer = gr.outputs.Textbox(label="Chart Summary")
30
+ examples = [["chart_example.png", "Which country has the second highest death rate?"], ]
31
+ #["chart_example_2.png"], ["chart_example_3.png"], ["chart_example_4.png"]]
32
 
33
+ title = "Interactive demo: chart QA"
34
+ description = "Gradio Demo for matcha model, fine-tuned on the ChartQA dataset. To use it, simply upload your image and click 'submit', or click one of the examples to load them."
35
 
36
  interface = gr.Interface(fn=summarize_chart,
37
  inputs=[image],