# AnjiBot 🤖 ### Computer Science Course Representative (Chatbot) from transformers import pipeline, TFTapasForQuestionAnswering, TapasTokenizer import pandas as pd import gradio as gr import tensorflow_probability # Load TAPAS model and table model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base-finetuned-sqa") tokenizer = TapasTokenizer.from_pretrained("google/tapas-base-finetuned-sqa") tqa = pipeline(task="table-question-answering", model=model, tokenizer=tokenizer) table = pd.read_csv('CSLECTURERS.csv') table = table.astype('str') messages = [] responses = [] def anjibot(message, history): messages.append(message) conversation = {"text": message, "past_user_input": messages, "generated_responses": responses} answer = tqa(table=table, query=message)["answer"] responses.append(answer) return "AnjiBot: " + answer chatbot = gr.ChatInterface(anjibot, title='AnjiBot', description="Anji is unavailable? That girl! Ask me, I may know!") chatbot.launch()