Joshnicholas commited on
Commit
7e27ec9
Β·
verified Β·
1 Parent(s): 1fbf7ae

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
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.read_excel(filepath).head(20).astype(str)
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 XLSX file"),
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 an XLSX file and/or enter text, and the processed output will be displayed.",
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