Threatthriver commited on
Commit
a26b3e0
·
verified ·
1 Parent(s): c72759d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -18,7 +18,7 @@ def chat_with_cerebras(user_input):
18
  # Create a chat stream with Cerebras
19
  stream = client.chat.completions.create(
20
  messages=[
21
- {"role": "system", "content": "You are a helpful assistant."},
22
  {"role": "user", "content": user_input}
23
  ],
24
  model="llama-3.3-70b",
@@ -44,7 +44,7 @@ def chat_with_cerebras(user_input):
44
  # Gradio interface
45
  def gradio_ui():
46
  with gr.Blocks() as demo:
47
- gr.Markdown("""# 🤖 Cerebras AI Chatbot\nChat with a state-of-the-art AI model!""")
48
 
49
  with gr.Row():
50
  with gr.Column(scale=8):
@@ -54,13 +54,20 @@ def gradio_ui():
54
 
55
  user_input = gr.Textbox(label="Type your message", placeholder="Ask me anything...", lines=2)
56
  send_button = gr.Button("Send", variant="primary")
 
57
 
58
  def handle_chat(chat_history, user_input):
59
  ai_response, compute_info = chat_with_cerebras(user_input)
60
  chat_history.append((user_input, ai_response))
61
  return chat_history, compute_info
62
 
 
 
 
63
  send_button.click(handle_chat, inputs=[chat_history, user_input], outputs=[chat_history, compute_time])
 
 
 
64
 
65
  return demo
66
 
 
18
  # Create a chat stream with Cerebras
19
  stream = client.chat.completions.create(
20
  messages=[
21
+ {"role": "system", "content": "You are IntellijMind, an advanced AI designed to assist users with detailed insights and problem-solving."},
22
  {"role": "user", "content": user_input}
23
  ],
24
  model="llama-3.3-70b",
 
44
  # Gradio interface
45
  def gradio_ui():
46
  with gr.Blocks() as demo:
47
+ gr.Markdown("""# 🚀 IntellijMind: The Future of AI Chatbots\nExperience the most advanced chatbot for deep insights and chain-of-thought reasoning!""")
48
 
49
  with gr.Row():
50
  with gr.Column(scale=8):
 
54
 
55
  user_input = gr.Textbox(label="Type your message", placeholder="Ask me anything...", lines=2)
56
  send_button = gr.Button("Send", variant="primary")
57
+ clear_button = gr.Button("Clear Chat")
58
 
59
  def handle_chat(chat_history, user_input):
60
  ai_response, compute_info = chat_with_cerebras(user_input)
61
  chat_history.append((user_input, ai_response))
62
  return chat_history, compute_info
63
 
64
+ def clear_chat():
65
+ return [], ""
66
+
67
  send_button.click(handle_chat, inputs=[chat_history, user_input], outputs=[chat_history, compute_time])
68
+ clear_button.click(clear_chat, outputs=[chat_history, compute_time])
69
+
70
+ gr.Markdown("""---\n### 🌟 Features:\n- **Advanced Reasoning**: Chain-of-thought explanations for complex queries.\n- **Performance Metrics**: Measure response compute time instantly.\n- **User-Friendly Design**: Intuitive chatbot interface.\n- **Powered by IntellijMind**: Redefining AI interaction standards.\n""")
71
 
72
  return demo
73