alyshacreelman commited on
Commit
d70f7c8
·
verified ·
1 Parent(s): 90d5d05

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
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.Button("Elementary School", elem_id="elementary-btn").click(lambda: "You are an elementary school teacher. Please respond with the vocabulary of the seven year old.", None, None, _js="elementary-btn")
143
- gr.Button("Middle School", elem_id="middle-btn").click(lambda: "You are a middle school teacher. Please respond at a level that middle schoolers can understand", None, None, _js="middle-btn")
144
- gr.Button("High School", elem_id="highschool-btn").click(lambda: "You are a high school teacher. Please respond at a level that a high school student can understand.", None, None, _js="highschool-btn")
145
- gr.Button("College", elem_id="college-btn").click(lambda: "You are a college Professor. Please respond with very advanced, college-level vocabulary.", None, None, _js="college-btn")
 
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)