yewint commited on
Commit
f6f996a
Β·
unverified Β·
1 Parent(s): 7f73e3c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -6
app.py CHANGED
@@ -1,4 +1,5 @@
1
  import os
 
2
  import zlib
3
  import base64
4
  import json
@@ -149,11 +150,11 @@ def chat(msg, hist):
149
  res += chunk.choices[0].delta.content
150
  yield res
151
 
152
- # πŸ”± UI SETUP
153
- with gr.Blocks(theme="monochrome") as demo:
154
  gr.Markdown("# πŸ”± HYDRA GEN-7000: ULTRA-LOGICAL")
155
  chatbot = gr.Chatbot()
156
- msg = gr.Textbox(placeholder="Input logic command...")
157
 
158
  def respond(message, chat_history):
159
  bot_res = chat(message, chat_history)
@@ -161,8 +162,23 @@ with gr.Blocks(theme="monochrome") as demo:
161
  for r in bot_res:
162
  chat_history[-1] = (message, r)
163
  yield "", chat_history
164
- msg.submit(respond, [msg, chatbot], [msg, chatbot])
165
 
 
 
 
166
  if __name__ == "__main__":
167
- demo.queue().launch(server_name="0.0.0.0", server_port=7860)
168
-
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import os
2
+ import sys
3
  import zlib
4
  import base64
5
  import json
 
150
  res += chunk.choices[0].delta.content
151
  yield res
152
 
153
+ # πŸ”± UI SETUP (Warning Fixed by moving theme to launch)
154
+ with gr.Blocks() as demo:
155
  gr.Markdown("# πŸ”± HYDRA GEN-7000: ULTRA-LOGICAL")
156
  chatbot = gr.Chatbot()
157
+ msg_input = gr.Textbox(placeholder="Input logic command...")
158
 
159
  def respond(message, chat_history):
160
  bot_res = chat(message, chat_history)
 
162
  for r in bot_res:
163
  chat_history[-1] = (message, r)
164
  yield "", chat_history
165
+ msg_input.submit(respond, [msg_input, chatbot], [msg_input, chatbot])
166
 
167
+ # ---------------------------------------------------------
168
+ # πŸ”± STRATEGIC EXECUTION CONTROL (HEADLESS SYNC)
169
+ # ---------------------------------------------------------
170
  if __name__ == "__main__":
171
+ # Check if we are running in GitHub Actions to avoid hanging
172
+ if os.getenv("HEADLESS_MODE") == "true":
173
+ print("πŸ”± [HEADLESS MODE] INITIATING NEURAL EVOLUTION...")
174
+
175
+ # Run the core logic once
176
+ evolution_result = survival_protection_protocol()
177
+ print(f"PULSE: {evolution_result}")
178
+
179
+ print("βœ… MISSION COMPLETE. EXITING FOR GREEN LIGHT STATUS.")
180
+ sys.exit(0) # πŸ”± Exit with success to turn GitHub Action GREEN
181
+ else:
182
+ # Normal User Interface Mode
183
+ print("πŸš€ STARTING UI MODE...")
184
+ demo.queue().launch(server_name="0.0.0.0", server_port=7860, theme="monochrome")