MarziehFadaee commited on
Commit
1b7769d
1 Parent(s): 12c6795

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -45,9 +45,8 @@ def generate_response(user_message, cid, history=None):
45
  return chat, history, cid
46
 
47
 
48
- def clear_chat(cid):
49
- cid = gr.State(str(uuid.uuid4()))
50
- return [], [], cid
51
 
52
 
53
  examples = [
@@ -80,7 +79,7 @@ with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
80
  with gr.Column(scale=1):
81
  gr.Image("logoplus.png", elem_id="logo-img", show_label=False, show_share_button=False, show_download_button=False)
82
  with gr.Column(scale=3):
83
- gr.Markdown("""C4AI Command R+ is a research open weights release of a 104B billion parameter with highly advanced Retrieval Augmented Generation (RAG) capabilities, tool Use to automate sophisticated tasks, and is multilingual in 10 languages: English, French, Spanish, Italian, German, Portuguese, Japanese, Korean, Arabic, and Chinese. Command R + is optimized for a variety of use cases including reasoning, summarization, and question answering.
84
  <br/><br/>
85
  **Model**: [c4ai-command-r-plus](https://huggingface.co/CohereForAI/c4ai-command-r-plus)
86
  <br/>
@@ -108,7 +107,7 @@ with gr.Blocks(analytics_enabled=False, css=custom_css) as demo:
108
  user_message.submit(fn=generate_response, inputs=[user_message, cid, history], outputs=[chatbot, history, cid], concurrency_limit=32)
109
 
110
  submit_button.click(fn=generate_response, inputs=[user_message, cid, history], outputs=[chatbot, history, cid], concurrency_limit=32)
111
- clear_button.click(fn=clear_chat, inputs=[cid], outputs=[chatbot, history, cid], concurrency_limit=32)
112
 
113
  user_message.submit(lambda x: gr.update(value=""), None, [user_message], queue=False)
114
  submit_button.click(lambda x: gr.update(value=""), None, [user_message], queue=False)
 
45
  return chat, history, cid
46
 
47
 
48
+ def clear_chat():
49
+ return [], [], str(uuid.uuid4())
 
50
 
51
 
52
  examples = [
 
79
  with gr.Column(scale=1):
80
  gr.Image("logoplus.png", elem_id="logo-img", show_label=False, show_share_button=False, show_download_button=False)
81
  with gr.Column(scale=3):
82
+ gr.Markdown("""C4AI Command R+ is a research open weights release of a 104B billion parameter with highly advanced Retrieval Augmented Generation (RAG) capabilities, tool Use to automate sophisticated tasks, and is multilingual in 10 languages: English, French, Spanish, Italian, German, Portuguese, Japanese, Korean, Arabic, and Chinese. Command R+ is optimized for a variety of use cases including reasoning, summarization, and question answering.
83
  <br/><br/>
84
  **Model**: [c4ai-command-r-plus](https://huggingface.co/CohereForAI/c4ai-command-r-plus)
85
  <br/>
 
107
  user_message.submit(fn=generate_response, inputs=[user_message, cid, history], outputs=[chatbot, history, cid], concurrency_limit=32)
108
 
109
  submit_button.click(fn=generate_response, inputs=[user_message, cid, history], outputs=[chatbot, history, cid], concurrency_limit=32)
110
+ clear_button.click(fn=clear_chat, inputs=None, outputs=[chatbot, history, cid], concurrency_limit=32)
111
 
112
  user_message.submit(lambda x: gr.update(value=""), None, [user_message], queue=False)
113
  submit_button.click(lambda x: gr.update(value=""), None, [user_message], queue=False)