pushkarweb commited on
Commit
e6b6fd2
·
1 Parent(s): 57a7937

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -5,15 +5,17 @@ import sys
5
  import os
6
  import random
7
  import time
8
-
 
 
9
  os.environ["OPENAI_API_KEY"] = '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'
10
 
11
 
12
- with gr.Blocks() as demo:
13
- chatbot = gr.Chatbot()
14
- msg = gr.Textbox()
15
  clear = gr.ClearButton([msg, chatbot])
16
-
17
 
18
  def respond(message, chat_history):
19
  index = GPTSimpleVectorIndex.load_from_disk('index.json')
@@ -23,6 +25,6 @@ with gr.Blocks() as demo:
23
  time.sleep(2)
24
  return "", chat_history
25
 
26
- msg.submit(respond, [msg, chatbot], [msg, chatbot])
27
 
28
  demo.launch()
 
5
  import os
6
  import random
7
  import time
8
+ theme = gr.themes.Base(
9
+ secondary_hue="gray",
10
+ )
11
  os.environ["OPENAI_API_KEY"] = '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'
12
 
13
 
14
+ with gr.Blocks(theme=theme) as demo:
15
+ chatbot = gr.Chatbot(label="SRF Interactive Chatbot",show_share_button="true")
16
+ msg = gr.Textbox(label="Ask me any question",placeholder="Send us a message")
17
  clear = gr.ClearButton([msg, chatbot])
18
+ btn = gr.Button(value="Submit")
19
 
20
  def respond(message, chat_history):
21
  index = GPTSimpleVectorIndex.load_from_disk('index.json')
 
25
  time.sleep(2)
26
  return "", chat_history
27
 
28
+ btn.click(respond, [msg, chatbot], [msg, chatbot])
29
 
30
  demo.launch()