Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
from transformers import pipeline
|
2 |
import pandas as pd
|
3 |
import gradio as gr
|
@@ -8,7 +10,7 @@ query = "what is the highest delta onu rx power?"
|
|
8 |
|
9 |
def main(filepath, query):
|
10 |
|
11 |
-
tableau = pd.
|
12 |
result = tqa(table=tableau, query=query)["answer"]
|
13 |
return result
|
14 |
|
@@ -16,12 +18,12 @@ def main(filepath, query):
|
|
16 |
iface = gr.Interface(
|
17 |
fn=main,
|
18 |
inputs=[
|
19 |
-
gr.File(type="filepath", label="Upload
|
20 |
gr.Textbox(type="text", label="Enter text"),
|
21 |
],
|
22 |
outputs=[gr.Textbox(type="text", label="Text Input Output")],
|
23 |
title="TM TableQA Test",
|
24 |
-
description="Upload
|
25 |
)
|
26 |
|
27 |
# Launch the Gradio interface
|
|
|
1 |
+
# This is based on https://huggingface.co/spaces/Abbasid/TableQA
|
2 |
+
|
3 |
from transformers import pipeline
|
4 |
import pandas as pd
|
5 |
import gradio as gr
|
|
|
10 |
|
11 |
def main(filepath, query):
|
12 |
|
13 |
+
tableau = pd.read_csv(filepath).astype(str)
|
14 |
result = tqa(table=tableau, query=query)["answer"]
|
15 |
return result
|
16 |
|
|
|
18 |
iface = gr.Interface(
|
19 |
fn=main,
|
20 |
inputs=[
|
21 |
+
gr.File(type="filepath", label="Upload csv"),
|
22 |
gr.Textbox(type="text", label="Enter text"),
|
23 |
],
|
24 |
outputs=[gr.Textbox(type="text", label="Text Input Output")],
|
25 |
title="TM TableQA Test",
|
26 |
+
description="Upload csv file and ask a qudstion, and the processed output will be displayed.",
|
27 |
)
|
28 |
|
29 |
# Launch the Gradio interface
|