Spaces:
Runtime error
Runtime error
File size: 785 Bytes
1fbf7ae |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
from transformers import pipeline
import pandas as pd
import gradio as gr
tqa = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-wtq")
query = "what is the highest delta onu rx power?"
def main(filepath, query):
tableau = pd.read_excel(filepath).head(20).astype(str)
result = tqa(table=tableau, query=query)["answer"]
return result
iface = gr.Interface(
fn=main,
inputs=[
gr.File(type="filepath", label="Upload XLSX file"),
gr.Textbox(type="text", label="Enter text"),
],
outputs=[gr.Textbox(type="text", label="Text Input Output")],
title="TM TableQA Test",
description="Upload an XLSX file and/or enter text, and the processed output will be displayed.",
)
# Launch the Gradio interface
iface.launch() |