radames commited on
Commit
40f9783
·
1 Parent(s): 5786c43

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import time
3
  import random
 
4
 
5
  get_window_url_params = """
6
  function() {
@@ -12,7 +13,7 @@ get_window_url_params = """
12
 
13
  with gr.Blocks() as demo:
14
  url_params = gr.JSON({}, visible=True, label="URL Params")
15
- chatbot = gr.Chatbot()
16
  msg = gr.Textbox()
17
  clear = gr.Button("Clear")
18
 
@@ -20,7 +21,10 @@ with gr.Blocks() as demo:
20
  return "", history + [[user_message, None]]
21
 
22
  def bot(history):
23
- bot_message = random.choice(["Yes", "No"])
 
 
 
24
  history[-1][1] = bot_message
25
  time.sleep(1)
26
  return history
 
1
  import gradio as gr
2
  import time
3
  import random
4
+ import json
5
 
6
  get_window_url_params = """
7
  function() {
 
13
 
14
  with gr.Blocks() as demo:
15
  url_params = gr.JSON({}, visible=True, label="URL Params")
16
+ chatbot = gr.Chatbot().style(height=500)
17
  msg = gr.Textbox()
18
  clear = gr.Button("Clear")
19
 
 
21
  return "", history + [[user_message, None]]
22
 
23
  def bot(history):
24
+ if "read query" in history[-1][0]:
25
+ bot_message = f""""```{json.dumps(url_params, indent=4})```"""
26
+ else:
27
+ bot_message = random.choice(["Yes", "No"])
28
  history[-1][1] = bot_message
29
  time.sleep(1)
30
  return history