|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from transformers import pipeline |
|
import pandas as pd |
|
|
|
tqa = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-wtq") |
|
|
|
|
|
|
|
|
|
|
|
tsqa = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-sqa") |
|
|
|
|
|
|
|
|
|
|
|
mstqa = pipeline(task="table-question-answering", model="microsoft/tapex-large-finetuned-wikisql") |
|
|
|
|
|
|
|
|
|
|
|
mswtqa = pipeline(task="table-question-answering", model="microsoft/tapex-large-finetuned-wtq") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
query = "what is the highest delta onu rx power?" |
|
query2 = "what is the lowest delta onu rx power?" |
|
query3 = "what is the most frequent login id?" |
|
query4 = "how many rows with nan values are there?" |
|
query5 = "how many S2 values are there" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main(filepath, query): |
|
|
|
table5 = pd.read_excel(filepath).head(20).astype(str) |
|
result = tsqa(table=table5, query=query)["answer"] |
|
return result |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import gradio as gr |
|
|
|
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="Multi-input Processor", |
|
description="Upload an XLSX file and/or enter text, and the processed output will be displayed.", |
|
) |
|
|
|
|
|
iface.launch() |
|
|
|
|
|
|
|
|
|
|
|
import os |
|
import subprocess |
|
|
|
|
|
subprocess.run(["jupyter", "nbconvert", "--to", "script", "--format", "script", "--output", "/content/", "/content/drive/MyDrive/Colab Notebooks/NEW TableQA-GRADIO: Hello World.ipynb"]) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|