king007 commited on
Commit
a7f975a
1 Parent(s): 2abe7fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -31,6 +31,7 @@ model = BartForConditionalGeneration.from_pretrained("microsoft/tapex-large-fine
31
 
32
  #new
33
  pipe_tapas = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-wtq")
 
34
 
35
 
36
 
@@ -45,18 +46,21 @@ def process2(query, csv_dataStr):
45
  result_tapex=tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
46
  #google
47
  result_tapas = pipe_tapas(table=table, query=query)['cells'][0]
48
- return result_tapex, result_tapas
 
 
49
 
50
 
51
  # Inputs
52
- query_text = gr.Text(label="Enter a question")
53
  # input_file = gr.File(label="Upload a CSV file", type="file")
54
- input_data = gr.Text(label="Input table json data")
55
  # rows_slider = gr.Slider(label="Number of rows")
56
 
57
  # Output
58
  answer_text_tapex = gr.Text(label="TAPEX answer")
59
  answer_text_tapas = gr.Text(label="TAPAS answer")
 
60
 
61
  description = "This Space lets you ask questions on CSV documents with Microsoft [TAPEX-Large](https://huggingface.co/microsoft/tapex-large-finetuned-wtq) and Google [TAPAS-Large](https://huggingface.co/google/tapas-large-finetuned-wtq). \
62
  Both have been fine-tuned on the [WikiTableQuestions](https://huggingface.co/datasets/wikitablequestions) dataset. \n\n\
@@ -74,7 +78,7 @@ iface = gr.Interface(
74
  layout="vertical",
75
  fn=process2,
76
  inputs=[query_text, input_data],
77
- outputs=[answer_text_tapex, answer_text_tapas],
78
  examples=[
79
 
80
  ],
 
31
 
32
  #new
33
  pipe_tapas = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-wtq")
34
+ pipe_tapas2 = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-wikisql-supervised")
35
 
36
 
37
 
 
46
  result_tapex=tokenizer.batch_decode(outputs, skip_special_tokens=True)[0]
47
  #google
48
  result_tapas = pipe_tapas(table=table, query=query)['cells'][0]
49
+ #google2
50
+ result_tapas2 = pipe_tapas2(table=table, query=query)['cells'][0]
51
+ return result_tapex, result_tapas, result_tapas2
52
 
53
 
54
  # Inputs
55
+ query_text = gr.Text(label="")
56
  # input_file = gr.File(label="Upload a CSV file", type="file")
57
+ input_data = gr.Text(label="")
58
  # rows_slider = gr.Slider(label="Number of rows")
59
 
60
  # Output
61
  answer_text_tapex = gr.Text(label="TAPEX answer")
62
  answer_text_tapas = gr.Text(label="TAPAS answer")
63
+ answer_text_tapas2 = gr.Text(label="TAPAS wikisql answer")
64
 
65
  description = "This Space lets you ask questions on CSV documents with Microsoft [TAPEX-Large](https://huggingface.co/microsoft/tapex-large-finetuned-wtq) and Google [TAPAS-Large](https://huggingface.co/google/tapas-large-finetuned-wtq). \
66
  Both have been fine-tuned on the [WikiTableQuestions](https://huggingface.co/datasets/wikitablequestions) dataset. \n\n\
 
78
  layout="vertical",
79
  fn=process2,
80
  inputs=[query_text, input_data],
81
+ outputs=[answer_text_tapex, answer_text_tapas, answer_text_tapas2],
82
  examples=[
83
 
84
  ],