botsi commited on
Commit
2772476
·
verified ·
1 Parent(s): da951c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -15
app.py CHANGED
@@ -67,6 +67,24 @@ if torch.cuda.is_available():
67
  tokenizer = AutoTokenizer.from_pretrained(model_id)
68
  tokenizer.use_default_system_prompt = False
69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
  with gr.Blocks(css="style.css") as demo:
71
  ## gradio-chatbot-read-query-param
72
  def get_window_url_params():
@@ -227,21 +245,6 @@ with gr.Blocks(css="style.css") as demo:
227
  #gr.Markdown(DESCRIPTION)
228
  #gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
229
  ## gradio-chatbot-read-query-param
230
-
231
- chat_interface = gr.ChatInterface(
232
- fn=generate,
233
- theme="soft",
234
- retry_btn=None,
235
- clear_btn=None,
236
- undo_btn=None,
237
- chatbot=gr.Chatbot(avatar_images=('user.png', 'bot.png'), bubble_full_width = False),
238
- examples=[
239
- ["Can you explain the rules very briefly again?"],
240
- ["How much should I invest in order to win?"],
241
- ["What happened in the last round?"],
242
- ["What is my probability to win if I do not share anything?"],
243
- ],
244
- )
245
 
246
  def get_session_index(chat_history, url_params):
247
  if chat_history and bool(chat_history[-1][0].strip()):
@@ -280,6 +283,7 @@ with gr.Blocks(css="style.css") as demo:
280
  chat_interface.render()
281
  #gr.Markdown(LICENSE)
282
 
 
283
  if __name__ == "__main__":
284
  #demo.queue(max_size=20).launch()
285
  demo.queue(max_size=20)
 
67
  tokenizer = AutoTokenizer.from_pretrained(model_id)
68
  tokenizer.use_default_system_prompt = False
69
 
70
+ def generate(message):
71
+ return message.upper()
72
+
73
+ chat_interface = gr.ChatInterface(
74
+ fn=generate,
75
+ theme="soft",
76
+ retry_btn=None,
77
+ clear_btn=None,
78
+ undo_btn=None,
79
+ chatbot=gr.Chatbot(avatar_images=('user.png', 'bot.png'), bubble_full_width = False),
80
+ examples=[
81
+ ["Can you explain the rules very briefly again?"],
82
+ ["How much should I invest in order to win?"],
83
+ ["What happened in the last round?"],
84
+ ["What is my probability to win if I do not share anything?"],
85
+ ],
86
+ )
87
+
88
  with gr.Blocks(css="style.css") as demo:
89
  ## gradio-chatbot-read-query-param
90
  def get_window_url_params():
 
245
  #gr.Markdown(DESCRIPTION)
246
  #gr.DuplicateButton(value="Duplicate Space for private use", elem_id="duplicate-button")
247
  ## gradio-chatbot-read-query-param
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
 
249
  def get_session_index(chat_history, url_params):
250
  if chat_history and bool(chat_history[-1][0].strip()):
 
283
  chat_interface.render()
284
  #gr.Markdown(LICENSE)
285
 
286
+
287
  if __name__ == "__main__":
288
  #demo.queue(max_size=20).launch()
289
  demo.queue(max_size=20)