Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ from transformers import pipeline
|
|
4 |
|
5 |
# Load the anomalies data
|
6 |
df = pd.read_csv('anomalies.csv', sep=',', decimal='.')
|
|
|
7 |
|
8 |
# Function to generate a response
|
9 |
def response(question):
|
@@ -12,7 +13,7 @@ def response(question):
|
|
12 |
raise TypeError(f"Esperado uma string para a pergunta, mas recebeu {type(question)}")
|
13 |
|
14 |
tqa = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-wtq")
|
15 |
-
|
16 |
return final_response
|
17 |
|
18 |
# Streamlit interface
|
|
|
4 |
|
5 |
# Load the anomalies data
|
6 |
df = pd.read_csv('anomalies.csv', sep=',', decimal='.')
|
7 |
+
df = df.applymap(str) # Converte todas as células para strings
|
8 |
|
9 |
# Function to generate a response
|
10 |
def response(question):
|
|
|
13 |
raise TypeError(f"Esperado uma string para a pergunta, mas recebeu {type(question)}")
|
14 |
|
15 |
tqa = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-wtq")
|
16 |
+
final_response = tqa(table=df, query=question)['cells'][0]
|
17 |
return final_response
|
18 |
|
19 |
# Streamlit interface
|