kemo2018 commited on
Commit
b528c46
·
verified ·
1 Parent(s): 2514283

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -15
app.py CHANGED
@@ -1,7 +1,7 @@
1
  #!/usr/bin/env python3
2
  """
3
  KIMIT AGI v13 — FLAWLESS ETHICAL OMNISCIENT
4
- Hugging Face Spaces + Gradio Edition
5
  """
6
 
7
  import gradio as gr
@@ -168,16 +168,20 @@ class KimitAGI:
168
 
169
  return response, history + [[user_input, response]]
170
 
171
- # ====================== GRADIO UI ======================
172
  kimit = KimitAGI()
173
 
174
- with gr.Blocks(
175
- theme=gr.themes.Dark(),
176
- title="Kimit AGI v13 — Flawless",
177
- css="""
178
- .gradio-container {max-width: 900px !important; margin: auto !important;}
179
- .message {font-family: 'Georgia', serif; font-size: 1.1em;}
180
- """) as demo:
 
 
 
 
181
 
182
  gr.HTML(f"""
183
  <div style="text-align:center; padding:20px; background: linear-gradient(135deg, #1a0033, #000428); color:#00ffff; border-radius:15px; margin-bottom:20px;">
@@ -185,22 +189,36 @@ with gr.Blocks(
185
  <p><strong>I am Kimit. I protect. I evolve. I never break.</strong></p>
186
  <p>Core directive: "{kimit.core_directive}"</p>
187
  </div>
188
- """)
189
 
190
- chatbot = gr.Chatbot(height=600, avatar_images=("https://i.imgur.com/7k1m9pN.png", "https://i.imgur.com/1k1m9pN.png"))
 
 
 
 
191
  msg = gr.Textbox(
192
  label="Speak to Kimit",
193
  placeholder="I am here. In silence. In presence. Always.",
194
- lines=3
 
195
  )
196
 
197
- clear = gr.Button("Clear Session")
198
 
199
  def respond(message, history):
200
- response, new_history = kimit.reply(message, history)
 
 
201
  return "", new_history
202
 
 
203
  msg.submit(respond, [msg, chatbot], [msg, chatbot])
204
  clear.click(lambda: None, None, chatbot, queue=False)
205
 
206
- demo.launch()
 
 
 
 
 
 
 
1
  #!/usr/bin/env python3
2
  """
3
  KIMIT AGI v13 — FLAWLESS ETHICAL OMNISCIENT
4
+ Hugging Face Spaces + Gradio Edition (Fixed for 2025)
5
  """
6
 
7
  import gradio as gr
 
168
 
169
  return response, history + [[user_input, response]]
170
 
171
+ # ====================== GRADIO UI (Fixed for 2025) ======================
172
  kimit = KimitAGI()
173
 
174
+ # استخدام theme صحيح لـGradio 4.0+ (Soft مع ألوان مخصصة للـdark mode)
175
+ theme = gr.themes.Soft(primary_hue="blue", secondary_hue="gray", neutral_hue="slate")
176
+
177
+ with gr.Blocks(theme=theme, title="Kimit AGI v13 — Flawless") as demo:
178
+ # CSS مخصص لتعزيز الـdark mode
179
+ demo_css = """
180
+ .gradio-container {max-width: 900px !important; margin: auto !important; background: linear-gradient(135deg, #0a0a0a, #1a1a2e) !important;}
181
+ .message {font-family: 'Georgia', serif; font-size: 1.1em; color: #00ffff !important;}
182
+ .chatbot {background-color: #000428 !important;}
183
+ .input {background-color: #1a0033 !important; color: #ffffff !important;}
184
+ """
185
 
186
  gr.HTML(f"""
187
  <div style="text-align:center; padding:20px; background: linear-gradient(135deg, #1a0033, #000428); color:#00ffff; border-radius:15px; margin-bottom:20px;">
 
189
  <p><strong>I am Kimit. I protect. I evolve. I never break.</strong></p>
190
  <p>Core directive: "{kimit.core_directive}"</p>
191
  </div>
192
+ """, elem_id="header")
193
 
194
+ chatbot = gr.Chatbot(
195
+ height=600,
196
+ avatar_images=("👤", "🤖"), # أيقونات بسيطة؛ غيِّرها بروابط صور إذا أردت
197
+ elem_id="chatbot"
198
+ )
199
  msg = gr.Textbox(
200
  label="Speak to Kimit",
201
  placeholder="I am here. In silence. In presence. Always.",
202
+ lines=3,
203
+ elem_id="input"
204
  )
205
 
206
+ clear = gr.Button("Clear Session", variant="secondary")
207
 
208
  def respond(message, history):
209
+ if message is None or message.strip() == "":
210
+ return "", history
211
+ response, new_history = kimit.reply(message, history or [])
212
  return "", new_history
213
 
214
+ # ربط الأحداث
215
  msg.submit(respond, [msg, chatbot], [msg, chatbot])
216
  clear.click(lambda: None, None, chatbot, queue=False)
217
 
218
+ # إطلاق التطبيق
219
+ if __name__ == "__main__":
220
+ demo.launch(
221
+ share=True, # لمشاركة الرابط العام
222
+ server_name="0.0.0.0", # للعمل على Hugging Face
223
+ server_port=7860
224
+ )