akellyirl commited on
Commit
f0e8369
·
1 Parent(s): d075e93

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -131,7 +131,7 @@ def text_fn():
131
  return None
132
 
133
 
134
- with gr.Blocks() as demo:
135
 
136
  gr.Markdown(f"""# I am StrathBot. A customised AI chatbot.
137
  <p style='font-size:16px;'>Let's chat about {topic}.</br></p>
@@ -148,15 +148,24 @@ with gr.Blocks() as demo:
148
  link="https://padlet.com/akellyirl/strathbot-flagging-2b4ko3rhk94wja6e")
149
  clear = gr.ClearButton([msg, chatbot])
150
 
151
- #msg.submit(predict, [msg, chatbot], [msg, chatbot])
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  # Submit on Enter or Button click
153
  gr.on(triggers=[msg.submit, submit.click],
154
  fn= predict, inputs=[msg, chatbot], outputs=[msg, chatbot],
155
- concurrency_limit = 100).then(text_fn)
156
-
157
- gr.Examples=([["What are the main topics?"],["Summarise the lesson"],["Explain this simply"],
158
- ["Suggest a topic"],["Tell me more about that"],
159
- ["Can I have a reference to read more?"],["Please provide citations."]],
160
- msg)
161
 
162
- demo.launch()
 
131
  return None
132
 
133
 
134
+ with gr.Blocks() as chat:
135
 
136
  gr.Markdown(f"""# I am StrathBot. A customised AI chatbot.
137
  <p style='font-size:16px;'>Let's chat about {topic}.</br></p>
 
148
  link="https://padlet.com/akellyirl/strathbot-flagging-2b4ko3rhk94wja6e")
149
  clear = gr.ClearButton([msg, chatbot])
150
 
151
+ examples=(["What are the main topics?","Summarise the lesson","Explain this simply",
152
+ "Suggest a topic","Tell me more about that",
153
+ "Can I have a reference to read more?","Please provide citations."])
154
+
155
+ def on_select(ex):
156
+ return ex
157
+
158
+ ex = {}
159
+ with gr.Group("Examples"):
160
+ with gr.Row():
161
+ for ind, exa in enumerate(examples):
162
+ ex[ind] = gr.Textbox(exa, container=False, interactive=True)
163
+ ex[ind].focus(fn=on_select, inputs=ex[ind], outputs=msg)
164
+
165
  # Submit on Enter or Button click
166
  gr.on(triggers=[msg.submit, submit.click],
167
  fn= predict, inputs=[msg, chatbot], outputs=[msg, chatbot],
168
+ concurrency_limit = 100,).then(text_fn)
169
+
 
 
 
 
170
 
171
+ chat.launch()