Update app.py
Browse files
app.py
CHANGED
@@ -1,13 +1,15 @@
|
|
1 |
# AnjiBot 🤖
|
2 |
### Computer Science Course Representative (Chatbot)
|
3 |
|
4 |
-
from transformers import pipeline
|
5 |
import pandas as pd
|
6 |
import gradio as gr
|
7 |
import tensorflow_probability
|
8 |
|
9 |
# Load TAPAS model and table
|
10 |
-
|
|
|
|
|
11 |
table = pd.read_csv('CSLECTURERS.csv')
|
12 |
table = table.astype('str')
|
13 |
|
@@ -65,12 +67,12 @@ light_mode_css = """
|
|
65 |
"""
|
66 |
|
67 |
|
68 |
-
|
69 |
|
70 |
theme_button = gr.Button("Toggle Theme", toggle_theme, default="light", choices=["light", "dark"])
|
71 |
-
|
72 |
|
73 |
|
74 |
-
|
75 |
|
76 |
-
|
|
|
1 |
# AnjiBot 🤖
|
2 |
### Computer Science Course Representative (Chatbot)
|
3 |
|
4 |
+
from transformers import pipeline, TFTapasForQuestionAnswering, TapasTokenizer
|
5 |
import pandas as pd
|
6 |
import gradio as gr
|
7 |
import tensorflow_probability
|
8 |
|
9 |
# Load TAPAS model and table
|
10 |
+
model = TFTapasForQuestionAnswering.from_pretrained("google/tapas-base-finetuned-sqa", skip_mismatch=True)
|
11 |
+
tokenizer = TapasTokenizer.from_pretrained("google/tapas-base-finetuned-sqa")
|
12 |
+
tqa = pipeline(task="table-question-answering", model=model, tokenizer=tokenizer)
|
13 |
table = pd.read_csv('CSLECTURERS.csv')
|
14 |
table = table.astype('str')
|
15 |
|
|
|
67 |
"""
|
68 |
|
69 |
|
70 |
+
chatbot = gr.ChatInterface(anjibot, title='AnjiBot', description="Anji is unavailable? That girl! Ask me, I may know!")
|
71 |
|
72 |
theme_button = gr.Button("Toggle Theme", toggle_theme, default="light", choices=["light", "dark"])
|
73 |
+
chatbot.add_input(theme_button)
|
74 |
|
75 |
|
76 |
+
chatbot.style(stylesheet=light_mode_css)
|
77 |
|
78 |
+
chatbot.launch()
|