Spaces:
Runtime error
Runtime error
Fangyu Liu
commited on
Commit
·
2773f58
1
Parent(s):
40a142f
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
import gradio as gr
|
| 2 |
-
import requests
|
| 3 |
-
from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor
|
| 4 |
import os
|
| 5 |
import torch
|
| 6 |
-
|
|
|
|
| 7 |
import transformers
|
|
|
|
|
|
|
| 8 |
|
| 9 |
## CoT prompts
|
| 10 |
|
|
@@ -147,8 +147,7 @@ def evaluate(
|
|
| 147 |
return output
|
| 148 |
|
| 149 |
|
| 150 |
-
|
| 151 |
-
|
| 152 |
model_deplot = Pix2StructForConditionalGeneration.from_pretrained("google/deplot")
|
| 153 |
processor_deplot = Pix2StructProcessor.from_pretrained("google/deplot")
|
| 154 |
|
|
@@ -184,7 +183,7 @@ demo = gr.Interface(
|
|
| 184 |
article=article,
|
| 185 |
enable_queue=True,
|
| 186 |
examples=[["deplot_case_study_m1.png", "What is the sum of numbers of Indonesia and Ireland? Remember to think step by step."],
|
| 187 |
-
["deplot_case_study_m1.png", "Summarise the chart for me please."]
|
| 188 |
["deplot_case_study_3.png", "By how much did China's growth rate drop? Think step by step."],
|
| 189 |
["deplot_case_study_4.png", "How many papers are submitted in 2020?"],
|
| 190 |
["deplot_case_study_x2.png", "Summarise the chart for me please."]],
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import torch
|
| 3 |
+
import requests
|
| 4 |
+
import gradio as gr
|
| 5 |
import transformers
|
| 6 |
+
from transformers import Pix2StructForConditionalGeneration, Pix2StructProcessor
|
| 7 |
+
from peft import PeftModel
|
| 8 |
|
| 9 |
## CoT prompts
|
| 10 |
|
|
|
|
| 147 |
return output
|
| 148 |
|
| 149 |
|
| 150 |
+
## deplot models
|
|
|
|
| 151 |
model_deplot = Pix2StructForConditionalGeneration.from_pretrained("google/deplot")
|
| 152 |
processor_deplot = Pix2StructProcessor.from_pretrained("google/deplot")
|
| 153 |
|
|
|
|
| 183 |
article=article,
|
| 184 |
enable_queue=True,
|
| 185 |
examples=[["deplot_case_study_m1.png", "What is the sum of numbers of Indonesia and Ireland? Remember to think step by step."],
|
| 186 |
+
["deplot_case_study_m1.png", "Summarise the chart for me please."],
|
| 187 |
["deplot_case_study_3.png", "By how much did China's growth rate drop? Think step by step."],
|
| 188 |
["deplot_case_study_4.png", "How many papers are submitted in 2020?"],
|
| 189 |
["deplot_case_study_x2.png", "Summarise the chart for me please."]],
|