Xyro123 commited on
Commit
1dad43b
·
verified ·
1 Parent(s): e632292

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -9
app.py CHANGED
@@ -2,7 +2,7 @@ import os
2
  import requests
3
  import gradio as gr
4
 
5
- # Gemini API key
6
  gemini_api_key = os.getenv("GEMINI_API_KEY")
7
  if gemini_api_key is None:
8
  raise ValueError("⚠️ GEMINI_API_KEY тохируулаагүй байна!")
@@ -25,26 +25,35 @@ def chat(prompt, history=[]):
25
  history.append((prompt, reply))
26
  return history, history
27
 
28
- # Custom CSS for chat design
29
  css = """
30
- .gradio-container {background-color: #0d1117 !important; color: #e6edf3;}
31
- h1, h3, h4, label {color: #00d9ff !important;}
32
  textarea, input {background-color:#161b22 !important; color:#fff !important; border-radius:10px;}
33
  button {background-color:#00d9ff !important; color:#000 !important; font-weight:bold; border-radius:10px;}
34
- .gradio-chatbot-message.user {background-color:#0f2c54; color:#fff; border-radius:15px; padding:10px;}
35
- .gradio-chatbot-message.bot {background-color:#1f1f1f; color:#00d9ff; border-radius:15px; padding:10px;}
 
 
36
  """
37
 
38
- # Gradio interface
 
 
39
  with gr.Blocks(css=css, theme=gr.themes.Soft()) as app:
40
- gr.Markdown("## 🚀 ZeppFusion AI Gemini Chat Only")
 
 
 
 
41
  chatbot = gr.Chatbot()
42
  msg = gr.Textbox(placeholder="Таны асуулт...")
43
  clear = gr.Button("🗑️ Clear History")
44
 
 
45
  msg.submit(chat, [msg, chatbot], [chatbot, chatbot])
46
 
47
- # Clear button
48
  clear.click(lambda: [], None, chatbot)
49
 
50
  if __name__ == "__main__":
 
2
  import requests
3
  import gradio as gr
4
 
5
+ # 🔑 Gemini API key
6
  gemini_api_key = os.getenv("GEMINI_API_KEY")
7
  if gemini_api_key is None:
8
  raise ValueError("⚠️ GEMINI_API_KEY тохируулаагүй байна!")
 
25
  history.append((prompt, reply))
26
  return history, history
27
 
28
+ # Custom CSS for ChatGPT-like design
29
  css = """
30
+ .gradio-container {background-color: #0d1117 !important; color: #e6edf3; font-family: 'Segoe UI', sans-serif;}
31
+ h1 {color:#00d9ff; font-size:2em; display:flex; align-items:center;}
32
  textarea, input {background-color:#161b22 !important; color:#fff !important; border-radius:10px;}
33
  button {background-color:#00d9ff !important; color:#000 !important; font-weight:bold; border-radius:10px;}
34
+ .gradio-chatbot-message.user {background-color:#0f2c54; color:#fff; border-radius:15px; padding:10px; margin:5px 0;}
35
+ .gradio-chatbot-message.bot {background-color:#1f1f1f; color:#00d9ff; border-radius:15px; padding:10px; margin:5px 0;}
36
+ .chat-header {display:flex; align-items:center; gap:10px;}
37
+ .chat-header img {height:50px; width:50px; border-radius:10px;}
38
  """
39
 
40
+ # Logo file (Space-д upload хийнэ)
41
+ logo_path = "logo.png" # өөрийн logo файл нэрийг оруулна
42
+
43
  with gr.Blocks(css=css, theme=gr.themes.Soft()) as app:
44
+ # Header with logo and app name
45
+ with gr.Row(elem_classes="chat-header"):
46
+ gr.Image(value=logo_path, show_label=False)
47
+ gr.Markdown("## ZeppFusion")
48
+
49
  chatbot = gr.Chatbot()
50
  msg = gr.Textbox(placeholder="Таны асуулт...")
51
  clear = gr.Button("🗑️ Clear History")
52
 
53
+ # Submit chat
54
  msg.submit(chat, [msg, chatbot], [chatbot, chatbot])
55
 
56
+ # Clear chat history
57
  clear.click(lambda: [], None, chatbot)
58
 
59
  if __name__ == "__main__":