Update app.py
Browse files
app.py
CHANGED
@@ -12,10 +12,20 @@ data = {
|
|
12 |
table = pd.DataFrame.from_dict(data)
|
13 |
|
14 |
# tapex accepts uncased input since it is pre-trained on the uncased corpus
|
15 |
-
query = "how many different countries had election in 21st century?"
|
16 |
-
encoding = tokenizer(table=table, query=query, return_tensors="pt")
|
17 |
|
18 |
-
outputs = model.generate(**encoding)
|
19 |
|
20 |
-
print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
|
21 |
-
# [' 2008.0']
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
table = pd.DataFrame.from_dict(data)
|
13 |
|
14 |
# tapex accepts uncased input since it is pre-trained on the uncased corpus
|
15 |
+
#query = "how many different countries had election in 21st century?"
|
16 |
+
#encoding = tokenizer(table=table, query=query, return_tensors="pt")
|
17 |
|
18 |
+
# outputs = model.generate(**encoding)
|
19 |
|
20 |
+
# print(tokenizer.batch_decode(outputs, skip_special_tokens=True))
|
21 |
+
# [' 2008.0']
|
22 |
+
|
23 |
+
def launch(input):
|
24 |
+
encoding = tokenizer(table=table, query=input, return_tensors="pt")
|
25 |
+
out=model.generate(**encoding)
|
26 |
+
return tokenizer.batch_decode(outputs, skip_special_tokens=True)
|
27 |
+
|
28 |
+
iface = gr.Interface(launch,
|
29 |
+
inputs="text",
|
30 |
+
outputs="text")
|
31 |
+
iface.launch(share=True)
|