jingwora commited on
Commit
456085a
·
1 Parent(s): 2e12ae2

Add application file

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -95,11 +95,11 @@ def predict(openai_gpt4_key, system_msg, inputs, top_p, temperature, chat_counte
95
  def reset_textbox():
96
  return gr.update(value='')
97
 
98
- #to set a component as visible=False
99
  def set_visible_false():
100
  return gr.update(visible=False)
101
 
102
- #to set a component as visible=True
103
  def set_visible_true():
104
  return gr.update(visible=True)
105
 
@@ -118,6 +118,10 @@ title = """
118
  </div>
119
  """
120
 
 
 
 
 
121
  with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;} #chatbot {height: 520px; overflow: auto;}""") as demo:
122
  gr.HTML(title)
123
 
@@ -125,7 +129,7 @@ with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;}
125
  #Users need to provide their own GPT4 API key, it is no longer provided by Huggingface
126
  with gr.Row():
127
  openai_gpt4_key = gr.Textbox(label="OpenAI GPT4 Key", value="", type="password", placeholder="API keys", info = "You have to provide your own GPT4 keys for this app to function properly",)
128
- with gr.Accordion(label="System message:", open=False):
129
  system_msg = gr.Textbox(label="Instruct the AI Assistant to set its beaviour", info = system_msg_info, value="",placeholder="Type here..")
130
  accordion_msg = gr.HTML(value="To set System message you will have to refresh the app", visible=False)
131
 
 
95
  def reset_textbox():
96
  return gr.update(value='')
97
 
98
+ # To set a component as visible=False
99
  def set_visible_false():
100
  return gr.update(visible=False)
101
 
102
+ # To set a component as visible=True
103
  def set_visible_true():
104
  return gr.update(visible=True)
105
 
 
118
  </div>
119
  """
120
 
121
+ # Using info to add additional information about System message in GPT4
122
+ system_msg_info = """System message helps set the behavior of the AI Assistant. """
123
+
124
+
125
  with gr.Blocks(css = """#col_container { margin-left: auto; margin-right: auto;} #chatbot {height: 520px; overflow: auto;}""") as demo:
126
  gr.HTML(title)
127
 
 
129
  #Users need to provide their own GPT4 API key, it is no longer provided by Huggingface
130
  with gr.Row():
131
  openai_gpt4_key = gr.Textbox(label="OpenAI GPT4 Key", value="", type="password", placeholder="API keys", info = "You have to provide your own GPT4 keys for this app to function properly",)
132
+ with gr.Accordion(label="System message:", open=True):
133
  system_msg = gr.Textbox(label="Instruct the AI Assistant to set its beaviour", info = system_msg_info, value="",placeholder="Type here..")
134
  accordion_msg = gr.HTML(value="To set System message you will have to refresh the app", visible=False)
135