-
Notifications
You must be signed in to change notification settings - Fork 0
/
Table_QN_ANS.py
20 lines (17 loc) · 1.73 KB
/
Table_QN_ANS.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from transformers import pipeline
import pandas as pd
import streamlit as st
import os
os.system ("conda install pytorch-scatter -c pyg")
#os.system("pip install git+https://github.com/rusty1s/pytorch_scatter")
# prepare table + question
st.title('''VIRTUAL ASSISTANT''')
data = {"Institute": ["Kiitec"], "CONTACT INFO of kiitec": ["Kiitec contact info\nP.O.Box 3172 Arusha, Tanzania.\nPhone: +255 27 250 4384\nMobile: +255 757 845 118\nEmail: [email protected]"], "Location": ["is located in Moshono, Arusha next to Masai Camp."], "Description of kiitec": [" is a technical institution registered by NACTE (REG/EOS/027) based in Moshono, Arusha next to Masai Camp. "], "Registration": ["Kiitec institution is registered by NACTE (REG/EOS/027)"], "Courses or programmes": ["Electronics & Telecommunication Engineering ,Industrial Automation\nComputer Engineering and Networking\nRenewable Energies, Environmental Impact\nFuture training programs or courses in development: Biomedical\nAvionics."], "Fee amount for diploma course": ["for first semester in diploma amount is 695,000 and 625,000 \n in second semister can be paid in two installment "], "Fees payment info": ["The fees should be paid through the BANK of ABSA\n and Account No is: 002-4001687\nAccount Name: KIITEC Ltd "], "Uniform information ": ["The dressing code of kiitec institution are dark blue trouser, light blue shirts for men and dark blue skirts, light blue shirts for women "]}
table = pd.DataFrame.from_dict(data)
query = st.text_input('Question', 'Contact info of kiitec')
# pipeline model
# Note: you must to install torch-scatter first.
tqa = pipeline(task="table-question-answering", model="google/tapas-large-finetuned-wtq")
# result
print(tqa(table=table, query=query)['cells'][0])
#53