awacke1 commited on
Commit
0861635
·
1 Parent(s): e9775b3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -4
app.py CHANGED
@@ -217,6 +217,19 @@ description = """
217
  # 6. Use Gradio to pull it all together
218
  with gr.Blocks(css = """#col_container {width: 1400px; margin-left: auto; margin-right: auto;} #chatbot {height: 600px; overflow: auto;}""") as demo:
219
  gr.HTML(title)
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  with gr.Column(elem_id = "col_container"):
221
  inputs = gr.Textbox(placeholder= "Hi there!", label= "Type an input and press Enter")
222
  chatbot = gr.Chatbot(elem_id='chatbot')
@@ -227,8 +240,7 @@ with gr.Blocks(css = """#col_container {width: 1400px; margin-left: auto; margin
227
  temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
228
  chat_counter = gr.Number(value=0, visible=True, precision=0)
229
 
230
-
231
- # Episodic/Semantic IO
232
  fileName = gr.Textbox(label="Filename")
233
  fileContent = gr.TextArea(label="File Content")
234
  completedMessage = gr.Textbox(label="Completed")
@@ -245,11 +257,13 @@ with gr.Blocks(css = """#col_container {width: 1400px; margin-left: auto; margin
245
  deleteFile.click(delete_file, inputs=fileName, outputs=completedMessage)
246
  appendFile.click(append_file, inputs=[fileName, fileContent], outputs=completedMessage )
247
 
248
-
 
249
  inputs.submit(predict, [inputs, top_p, temperature,chat_counter, chatbot, state], [chatbot, state, chat_counter])
250
  b1.click(predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter])
251
  b1.click(reset_textbox, [], [inputs])
252
  inputs.submit(reset_textbox, [], [inputs])
253
  gr.Markdown(description)
254
-
 
255
  demo.queue().launch(debug=True)
 
217
  # 6. Use Gradio to pull it all together
218
  with gr.Blocks(css = """#col_container {width: 1400px; margin-left: auto; margin-right: auto;} #chatbot {height: 600px; overflow: auto;}""") as demo:
219
  gr.HTML(title)
220
+
221
+ # Wikipedia context preloader
222
+ with gr.Row(): # inputs and buttons
223
+ inp = gr.Textbox(lines=1, default="ChatGPT", label="Question")
224
+ with gr.Row(): # inputs and buttons
225
+ b4 = gr.Button("Search Web Live")
226
+ with gr.Row(): # output DF2
227
+ out_DF = gr.Dataframe(wrap=True, max_rows=1000, overflow_row_behaviour= "paginate", datatype = ["markdown", "markdown"], headers=['Entity', 'Value'])
228
+ inp.submit(fn=get_wiki_summary, inputs=inp, outputs=out_DF)
229
+ b4.click(fn=get_wiki_summary, inputs=inp, outputs=out_DF )
230
+
231
+
232
+ # Accordian chat bot
233
  with gr.Column(elem_id = "col_container"):
234
  inputs = gr.Textbox(placeholder= "Hi there!", label= "Type an input and press Enter")
235
  chatbot = gr.Chatbot(elem_id='chatbot')
 
240
  temperature = gr.Slider( minimum=-0, maximum=5.0, value=1.0, step=0.1, interactive=True, label="Temperature",)
241
  chat_counter = gr.Number(value=0, visible=True, precision=0)
242
 
243
+ # Episodic/Semantic Memory IO
 
244
  fileName = gr.Textbox(label="Filename")
245
  fileContent = gr.TextArea(label="File Content")
246
  completedMessage = gr.Textbox(label="Completed")
 
257
  deleteFile.click(delete_file, inputs=fileName, outputs=completedMessage)
258
  appendFile.click(append_file, inputs=[fileName, fileContent], outputs=completedMessage )
259
 
260
+
261
+ # Chatbot
262
  inputs.submit(predict, [inputs, top_p, temperature,chat_counter, chatbot, state], [chatbot, state, chat_counter])
263
  b1.click(predict, [inputs, top_p, temperature, chat_counter, chatbot, state], [chatbot, state, chat_counter])
264
  b1.click(reset_textbox, [], [inputs])
265
  inputs.submit(reset_textbox, [], [inputs])
266
  gr.Markdown(description)
267
+
268
+ # Queue and go!
269
  demo.queue().launch(debug=True)