kavansaun commited on
Commit
b08b318
·
verified ·
1 Parent(s): 7e62c78

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -10
app.py CHANGED
@@ -8,9 +8,9 @@ import time
8
 
9
  openai.api_key = os.getenv('OPENAI_KEY') # Initializing secrets
10
  g = Github(os.getenv('GITHUB_KEY'))
11
-
12
  user_dictionary = {} #A dictionary that we can save mutible server side information. This will be formatted {new_id:message_history}
13
 
 
14
  with gr.Blocks(theme=gr.themes.Monochrome(),css="footer{display:none !important}") as chatblock: # Creating UI using gradio Blocks. This line sets the block as a variable called "chatblock", the theme as monochrome, and removes the footer of the page.
15
  user_id = gr.TextArea(visible=False) # Displaying the user id, it is made not-visible because the id hasnt been created yet and we dont want the user seeing it anyway.
16
 
@@ -76,17 +76,11 @@ with gr.Blocks(theme=gr.themes.Monochrome(),css="footer{display:none !important}
76
 
77
  return response # Returning the chat bot response
78
 
79
- ChatInterface = gr.ChatInterface(predict_prompt, type="messages")
80
  initial_message = "Please write your prompt here and press 'enter'" # Initial message for the User Interface (basically the message for the typing input area so change the message under the quotes if you want to change that)
81
  Chatbot = gr.Chatbot(label="Anonymous User") # Creating a gradio-chatbot User Interface with the label "Anonymous User".
82
-
83
- txt = gr.Textbox(
84
- show_label=False,
85
- placeholder = initial_message,
86
- container=False
87
- )
88
 
89
- # Adding the messages into the row with gradio.
90
- txt.submit(predict_prompt, [txt, user_id], ChatInterface)
91
 
92
  chatblock.launch() # launch!
 
8
 
9
  openai.api_key = os.getenv('OPENAI_KEY') # Initializing secrets
10
  g = Github(os.getenv('GITHUB_KEY'))
 
11
  user_dictionary = {} #A dictionary that we can save mutible server side information. This will be formatted {new_id:message_history}
12
 
13
+
14
  with gr.Blocks(theme=gr.themes.Monochrome(),css="footer{display:none !important}") as chatblock: # Creating UI using gradio Blocks. This line sets the block as a variable called "chatblock", the theme as monochrome, and removes the footer of the page.
15
  user_id = gr.TextArea(visible=False) # Displaying the user id, it is made not-visible because the id hasnt been created yet and we dont want the user seeing it anyway.
16
 
 
76
 
77
  return response # Returning the chat bot response
78
 
79
+
80
  initial_message = "Please write your prompt here and press 'enter'" # Initial message for the User Interface (basically the message for the typing input area so change the message under the quotes if you want to change that)
81
  Chatbot = gr.Chatbot(label="Anonymous User") # Creating a gradio-chatbot User Interface with the label "Anonymous User".
 
 
 
 
 
 
82
 
83
+ txt = gr.Textbox(show_label=False, placeholder = initial_message,container=False)
84
+ txt.submit(predict_prompt, [txt, user_id], Chatbot) # Adding the messages into the row with gradio.
85
 
86
  chatblock.launch() # launch!