Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,17 +33,18 @@ def process(query, file, correct_answer, rows=20):
|
|
| 33 |
return result_tapex["answer"], result_tapas["answer"], correct_answer
|
| 34 |
|
| 35 |
def process2(query, csv_data):
|
|
|
|
| 36 |
table = pd.DataFrame.from_dict(csv_data)
|
| 37 |
# result_tapex = pipe_tapex(table=table, query=query)
|
| 38 |
result_tapas = pipe_tapas(table=table, query=query)['cells'][0]
|
| 39 |
-
return "", result_tapas
|
| 40 |
|
| 41 |
|
| 42 |
# Inputs
|
| 43 |
query_text = gr.Text(label="Enter a question")
|
| 44 |
# input_file = gr.File(label="Upload a CSV file", type="file")
|
| 45 |
input_data = gr.Text(label="Input table json data")
|
| 46 |
-
rows_slider = gr.Slider(label="Number of rows")
|
| 47 |
|
| 48 |
# Output
|
| 49 |
answer_text_tapex = gr.Text(label="TAPEX answer")
|
|
@@ -64,7 +65,7 @@ iface = gr.Interface(
|
|
| 64 |
description=description,
|
| 65 |
layout="vertical",
|
| 66 |
fn=process2,
|
| 67 |
-
inputs=[query_text, input_data
|
| 68 |
outputs=[answer_text_tapex, answer_text_tapas],
|
| 69 |
examples=[
|
| 70 |
|
|
|
|
| 33 |
return result_tapex["answer"], result_tapas["answer"], correct_answer
|
| 34 |
|
| 35 |
def process2(query, csv_data):
|
| 36 |
+
csv_data={"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}
|
| 37 |
table = pd.DataFrame.from_dict(csv_data)
|
| 38 |
# result_tapex = pipe_tapex(table=table, query=query)
|
| 39 |
result_tapas = pipe_tapas(table=table, query=query)['cells'][0]
|
| 40 |
+
return "", result_tapas
|
| 41 |
|
| 42 |
|
| 43 |
# Inputs
|
| 44 |
query_text = gr.Text(label="Enter a question")
|
| 45 |
# input_file = gr.File(label="Upload a CSV file", type="file")
|
| 46 |
input_data = gr.Text(label="Input table json data")
|
| 47 |
+
# rows_slider = gr.Slider(label="Number of rows")
|
| 48 |
|
| 49 |
# Output
|
| 50 |
answer_text_tapex = gr.Text(label="TAPEX answer")
|
|
|
|
| 65 |
description=description,
|
| 66 |
layout="vertical",
|
| 67 |
fn=process2,
|
| 68 |
+
inputs=[query_text, input_data],
|
| 69 |
outputs=[answer_text_tapex, answer_text_tapas],
|
| 70 |
examples=[
|
| 71 |
|