Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -31,23 +31,25 @@ def process(query, file, correct_answer, rows=20):
|
|
31 |
|
32 |
|
33 |
# Inputs
|
34 |
-
query_text = gr.Text(label="
|
35 |
-
input_file = gr.File(label="
|
36 |
-
rows_slider = gr.Slider(label="
|
37 |
|
38 |
# Output
|
39 |
answer_text_tapex = gr.Text(label="TAPEX answer")
|
40 |
answer_text_tapas = gr.Text(label="TAPAS answer")
|
41 |
|
42 |
-
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). \
|
43 |
-
Both have been fine-tuned on the [WikiTableQuestions](https://huggingface.co/datasets/wikitablequestions) dataset. \n\n\
|
44 |
-
A sample file with football statistics is available in the repository: \n\n\
|
45 |
-
* Which team has the most wins? Answer: Manchester City FC\n\
|
46 |
-
* Which team has the most wins: Chelsea, Liverpool or Everton? Answer: Liverpool\n\
|
47 |
-
* Which teams have scored less than 40 goals? Answer: Cardiff City FC, Fulham FC, Brighton & Hove Albion FC, Huddersfield Town FC\n\
|
48 |
-
* What is the average number of wins? Answer: 16 (rounded)\n\n\
|
49 |
-
You can also upload your own CSV file. Please note that maximum sequence length for both models is 1024 tokens, \
|
50 |
-
so you may need to limit the number of rows in your CSV file. Chunking is not implemented yet."
|
|
|
|
|
51 |
|
52 |
iface = gr.Interface(
|
53 |
theme="huggingface",
|
@@ -56,16 +58,16 @@ iface = gr.Interface(
|
|
56 |
fn=process,
|
57 |
inputs=[query_text, input_file, rows_slider],
|
58 |
outputs=[answer_text_tapex, answer_text_tapas],
|
59 |
-
examples=[
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
],
|
69 |
allow_flagging="never",
|
70 |
)
|
71 |
|
|
|
31 |
|
32 |
|
33 |
# Inputs
|
34 |
+
query_text = gr.Text(label="")
|
35 |
+
input_file = gr.File(label="", type="file")
|
36 |
+
rows_slider = gr.Slider(label="")
|
37 |
|
38 |
# Output
|
39 |
answer_text_tapex = gr.Text(label="TAPEX answer")
|
40 |
answer_text_tapas = gr.Text(label="TAPAS answer")
|
41 |
|
42 |
+
# 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). \
|
43 |
+
# Both have been fine-tuned on the [WikiTableQuestions](https://huggingface.co/datasets/wikitablequestions) dataset. \n\n\
|
44 |
+
# A sample file with football statistics is available in the repository: \n\n\
|
45 |
+
# * Which team has the most wins? Answer: Manchester City FC\n\
|
46 |
+
# * Which team has the most wins: Chelsea, Liverpool or Everton? Answer: Liverpool\n\
|
47 |
+
# * Which teams have scored less than 40 goals? Answer: Cardiff City FC, Fulham FC, Brighton & Hove Albion FC, Huddersfield Town FC\n\
|
48 |
+
# * What is the average number of wins? Answer: 16 (rounded)\n\n\
|
49 |
+
# You can also upload your own CSV file. Please note that maximum sequence length for both models is 1024 tokens, \
|
50 |
+
# so you may need to limit the number of rows in your CSV file. Chunking is not implemented yet."
|
51 |
+
|
52 |
+
description=""
|
53 |
|
54 |
iface = gr.Interface(
|
55 |
theme="huggingface",
|
|
|
58 |
fn=process,
|
59 |
inputs=[query_text, input_file, rows_slider],
|
60 |
outputs=[answer_text_tapex, answer_text_tapas],
|
61 |
+
# examples=[
|
62 |
+
# ["Which team has the most wins?", "default_file.csv", 20],
|
63 |
+
# [
|
64 |
+
# "Which team has the most wins: Chelsea, Liverpool or Everton?",
|
65 |
+
# "default_file.csv",
|
66 |
+
# 20,
|
67 |
+
# ],
|
68 |
+
# ["Which teams have scored less than 40 goals?", "default_file.csv", 20],
|
69 |
+
# ["What is the average number of wins?", "default_file.csv", 20],
|
70 |
+
# ],
|
71 |
allow_flagging="never",
|
72 |
)
|
73 |
|