Fangyu Liu commited on
Commit
6663c9a
1 Parent(s): e9f0c2c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -54,7 +54,7 @@ def text_generate(prompt, table, problem):
54
  {
55
  "top_p": 0.9,
56
  "temperature": 1.1,
57
- "max_new_tokens": 64,
58
  "return_full_text": True
59
  }, "options":
60
  {
@@ -65,7 +65,7 @@ def text_generate(prompt, table, problem):
65
  print(f"Response is : {response}")
66
  output = response.json()
67
  print(f"output is : {output}") #{output}")
68
- output_tmp = output[0]['generated_text']
69
  print(f"output_tmp is: {output_tmp}")
70
  #solution = output_tmp.split("\nQ:")[0] #output[0]['generated_text'].split("Q:")[0] # +"."
71
  #print(f"Final response after splits is: {solution}")
@@ -89,8 +89,8 @@ def process_document(image, question):
89
  res = text_generate(_TEMPLATE, table, question)
90
  print (res)
91
 
92
- description = "Demo for pix2struct fine-tuned on DocVQA (document visual question answering). To use it, simply upload your image and type a question and click 'submit', or click one of the examples to load them. Read more at the links below."
93
- article = "<p style='text-align: center'><a href='https://arxiv.org/pdf/2210.03347.pdf' target='_blank'>PIX2STRUCT: SCREENSHOT PARSING AS PRETRAINING FOR VISUAL LANGUAGE UNDERSTANDING</a></p>"
94
 
95
  demo = gr.Interface(
96
  fn=process_document,
 
54
  {
55
  "top_p": 0.9,
56
  "temperature": 1.1,
57
+ "max_new_tokens": 128,
58
  "return_full_text": True
59
  }, "options":
60
  {
 
65
  print(f"Response is : {response}")
66
  output = response.json()
67
  print(f"output is : {output}") #{output}")
68
+ output_tmp = output['generated_text']
69
  print(f"output_tmp is: {output_tmp}")
70
  #solution = output_tmp.split("\nQ:")[0] #output[0]['generated_text'].split("Q:")[0] # +"."
71
  #print(f"Final response after splits is: {solution}")
 
89
  res = text_generate(_TEMPLATE, table, question)
90
  print (res)
91
 
92
+ description = "Demo for deplot+llm for QA or summarisation. To use it, simply upload your image and type a question and click 'submit', or click one of the examples to load them. Read more at the links below."
93
+ article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2212.10505' target='_blank'>DePlot: One-shot visual language reasoning by plot-to-table translation</a></p>"
94
 
95
  demo = gr.Interface(
96
  fn=process_document,