Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,6 @@ pipe = pipeline("text-generation", "microsoft/Phi-3-mini-4k-instruct", torch_dty
|
|
10 |
# Global flag to handle cancellation
|
11 |
stop_inference = False
|
12 |
|
13 |
-
# Define responses
|
14 |
def respond(
|
15 |
message,
|
16 |
history: list[tuple[str, str]],
|
@@ -139,10 +138,11 @@ with gr.Blocks(css=custom_css) as demo:
|
|
139 |
gr.Markdown("Interact with Wormington Scholar 🐛 by selecting the appropriate level below.")
|
140 |
|
141 |
with gr.Row():
|
142 |
-
gr.
|
143 |
-
gr.Button("
|
144 |
-
gr.Button("
|
145 |
-
gr.Button("
|
|
|
146 |
|
147 |
with gr.Row():
|
148 |
use_local_model = gr.Checkbox(label="Use Local Model", value=False)
|
|
|
10 |
# Global flag to handle cancellation
|
11 |
stop_inference = False
|
12 |
|
|
|
13 |
def respond(
|
14 |
message,
|
15 |
history: list[tuple[str, str]],
|
|
|
138 |
gr.Markdown("Interact with Wormington Scholar 🐛 by selecting the appropriate level below.")
|
139 |
|
140 |
with gr.Row():
|
141 |
+
system_message = gr.State(value="You are a friendly Chatbot.")
|
142 |
+
gr.Button("Elementary School").click(lambda: system_message.update("You are an elementary school teacher. Please respond with the vocabulary of the seven year old."))
|
143 |
+
gr.Button("Middle School").click(lambda: system_message.update("You are a middle school teacher. Please respond at a level that middle schoolers can understand"))
|
144 |
+
gr.Button("High School").click(lambda: system_message.update("You are a high school teacher. Please respond at a level that a high school student can understand."))
|
145 |
+
gr.Button("College").click(lambda: system_message.update("You are a college Professor. Please respond with very advanced, college-level vocabulary."))
|
146 |
|
147 |
with gr.Row():
|
148 |
use_local_model = gr.Checkbox(label="Use Local Model", value=False)
|