Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,10 +22,10 @@ pipe_tapas = pipeline(
|
|
| 22 |
)
|
| 23 |
|
| 24 |
|
| 25 |
-
def process(query,
|
| 26 |
# table = pd.read_csv(file.name, header=0).astype(str)
|
| 27 |
# table = table[:rows]
|
| 28 |
-
table = pd.DataFrame.from_dict(
|
| 29 |
result_tapex = pipe_tapex(table=table, query=query)
|
| 30 |
result_tapas = pipe_tapas(table=table, query=query)
|
| 31 |
return result_tapex["answer"], result_tapas["answer"], correct_answer
|
|
@@ -59,8 +59,6 @@ iface = gr.Interface(
|
|
| 59 |
inputs=[query_text, input_data, rows_slider],
|
| 60 |
outputs=[answer_text_tapex, answer_text_tapas],
|
| 61 |
examples=[
|
| 62 |
-
["how many movies does Leonardo Di Caprio have?", "{"Actors": ["Brad Pitt", "Leonardo Di Caprio", "George Clooney"], "Number of movies": ["87", "53", "69"]}", 20],
|
| 63 |
-
["how many movies does Leonardo Di Caprio have?", "{"Rank": ["1", "2", "3"], "Name": ["87", "53", "69"]}", 20],
|
| 64 |
|
| 65 |
],
|
| 66 |
allow_flagging="never",
|
|
|
|
| 22 |
)
|
| 23 |
|
| 24 |
|
| 25 |
+
def process(query, csv_data, correct_answer, rows=20):
|
| 26 |
# table = pd.read_csv(file.name, header=0).astype(str)
|
| 27 |
# table = table[:rows]
|
| 28 |
+
table = pd.DataFrame.from_dict(csv_data)
|
| 29 |
result_tapex = pipe_tapex(table=table, query=query)
|
| 30 |
result_tapas = pipe_tapas(table=table, query=query)
|
| 31 |
return result_tapex["answer"], result_tapas["answer"], correct_answer
|
|
|
|
| 59 |
inputs=[query_text, input_data, rows_slider],
|
| 60 |
outputs=[answer_text_tapex, answer_text_tapas],
|
| 61 |
examples=[
|
|
|
|
|
|
|
| 62 |
|
| 63 |
],
|
| 64 |
allow_flagging="never",
|