Speedofmastery commited on
Commit
7427260
Β·
1 Parent(s): c79205c

Auto-commit: app.py updated

Browse files
Files changed (1) hide show
  1. app.py +67 -67
app.py CHANGED
@@ -132,13 +132,13 @@ def init_database():
132
  # Use Linux-friendly paths
133
  data_dir = Path("/home/user/app/data")
134
  data_dir.mkdir(exist_ok=True)
135
-
136
  db_path = data_dir / "openmanus.db"
137
  logger.info(f"Initializing database at {db_path}")
138
-
139
  conn = sqlite3.connect(str(db_path))
140
  cursor = conn.cursor()
141
-
142
  # Create users table
143
  cursor.execute("""
144
  CREATE TABLE IF NOT EXISTS users (
@@ -151,7 +151,7 @@ def init_database():
151
  is_active BOOLEAN DEFAULT 1
152
  )
153
  """)
154
-
155
  # Create sessions table
156
  cursor.execute("""
157
  CREATE TABLE IF NOT EXISTS sessions (
@@ -164,7 +164,7 @@ def init_database():
164
  FOREIGN KEY (user_id) REFERENCES users (id)
165
  )
166
  """)
167
-
168
  # Create model usage table
169
  cursor.execute("""
170
  CREATE TABLE IF NOT EXISTS model_usage (
@@ -179,12 +179,12 @@ def init_database():
179
  FOREIGN KEY (user_id) REFERENCES users (id)
180
  )
181
  """)
182
-
183
  conn.commit()
184
  conn.close()
185
  logger.info("Database initialized successfully")
186
  return True
187
-
188
  except Exception as e:
189
  logger.error(f"Database initialization failed: {e}")
190
  return False
@@ -197,39 +197,39 @@ def signup_user(mobile, name, password, confirm_password):
197
  """User registration with mobile number"""
198
  if not all([mobile, name, password, confirm_password]):
199
  return "❌ Please fill in all fields"
200
-
201
  if password != confirm_password:
202
  return "❌ Passwords do not match"
203
-
204
  if len(password) < 6:
205
  return "❌ Password must be at least 6 characters"
206
-
207
  # Validate mobile number
208
  if not mobile.replace("+", "").replace("-", "").replace(" ", "").isdigit():
209
  return "❌ Please enter a valid mobile number"
210
-
211
  try:
212
  conn = sqlite3.connect("openmanus.db")
213
  cursor = conn.cursor()
214
-
215
  # Check if mobile number already exists
216
  cursor.execute("SELECT id FROM users WHERE mobile_number = ?", (mobile,))
217
  if cursor.fetchone():
218
  conn.close()
219
  return "❌ Mobile number already registered"
220
-
221
  # Create new user
222
  password_hash = hash_password(password)
223
  cursor.execute("""
224
  INSERT INTO users (mobile_number, full_name, password_hash)
225
  VALUES (?, ?, ?)
226
  """, (mobile, name, password_hash))
227
-
228
  conn.commit()
229
  conn.close()
230
-
231
  return f"βœ… Account created successfully for {name}! Welcome to OpenManus Platform."
232
-
233
  except Exception as e:
234
  return f"❌ Registration failed: {str(e)}"
235
 
@@ -237,18 +237,18 @@ def login_user(mobile, password):
237
  """User authentication"""
238
  if not mobile or not password:
239
  return "❌ Please provide mobile number and password"
240
-
241
  try:
242
  conn = sqlite3.connect("openmanus.db")
243
  cursor = conn.cursor()
244
-
245
  # Verify credentials
246
  password_hash = hash_password(password)
247
  cursor.execute("""
248
- SELECT id, full_name FROM users
249
  WHERE mobile_number = ? AND password_hash = ? AND is_active = 1
250
  """, (mobile, password_hash))
251
-
252
  user = cursor.fetchone()
253
  if user:
254
  # Update last login
@@ -257,12 +257,12 @@ def login_user(mobile, password):
257
  """, (user[0],))
258
  conn.commit()
259
  conn.close()
260
-
261
  return f"βœ… Welcome back, {user[1]}! Login successful."
262
  else:
263
  conn.close()
264
  return "❌ Invalid mobile number or password"
265
-
266
  except Exception as e:
267
  return f"❌ Login failed: {str(e)}"
268
 
@@ -270,7 +270,7 @@ def use_ai_model(model_name, input_text, user_session="guest"):
270
  """Simulate AI model usage"""
271
  if not input_text.strip():
272
  return "Please enter some text for the AI model to process."
273
-
274
  # Simulate model processing
275
  response_templates = {
276
  "text": f"🧠 {model_name} processed: '{input_text}'\n\n✨ AI Response: This is a simulated response from the {model_name} model. In production, this would connect to the actual model API.",
@@ -278,43 +278,43 @@ def use_ai_model(model_name, input_text, user_session="guest"):
278
  "audio": f"🎡 {model_name} audio processing for: '{input_text}'\n\nπŸ”Š Output: Audio generated/processed (simulated)",
279
  "multimodal": f"πŸ€– {model_name} multimodal processing: '{input_text}'\n\n🎯 Output: Combined AI analysis complete (simulated)"
280
  }
281
-
282
  # Determine response type based on model
283
  if any(x in model_name.lower() for x in ["image", "flux", "diffusion", "face", "avatar"]):
284
  response_type = "image"
285
  elif any(x in model_name.lower() for x in ["tts", "speech", "audio", "whisper", "wav2vec"]):
286
- response_type = "audio"
287
  elif any(x in model_name.lower() for x in ["vl", "blip", "vision", "talking"]):
288
  response_type = "multimodal"
289
  else:
290
  response_type = "text"
291
-
292
  return response_templates[response_type]
293
 
294
  def get_cloudflare_status():
295
  """Get Cloudflare services status"""
296
  services = []
297
-
298
  if CLOUDFLARE_CONFIG["d1_database_id"]:
299
  services.append("βœ… D1 Database Connected")
300
  else:
301
  services.append("βš™οΈ D1 Database (Configure CLOUDFLARE_D1_DATABASE_ID)")
302
-
303
  if CLOUDFLARE_CONFIG["r2_bucket_name"]:
304
- services.append("βœ… R2 Storage Connected")
305
  else:
306
  services.append("βš™οΈ R2 Storage (Configure CLOUDFLARE_R2_BUCKET_NAME)")
307
-
308
  if CLOUDFLARE_CONFIG["kv_namespace_id"]:
309
  services.append("βœ… KV Cache Connected")
310
  else:
311
  services.append("βš™οΈ KV Cache (Configure CLOUDFLARE_KV_NAMESPACE_ID)")
312
-
313
  if CLOUDFLARE_CONFIG["durable_objects_id"]:
314
  services.append("βœ… Durable Objects Connected")
315
  else:
316
  services.append("βš™οΈ Durable Objects (Configure CLOUDFLARE_DURABLE_OBJECTS_ID)")
317
-
318
  return "\n".join(services)
319
 
320
  # Initialize database
@@ -322,7 +322,7 @@ init_database()
322
 
323
  # Create Gradio interface
324
  with gr.Blocks(
325
- title="OpenManus - Complete AI Platform",
326
  theme=gr.themes.Soft(),
327
  css="""
328
  .container { max-width: 1400px; margin: 0 auto; }
@@ -330,7 +330,7 @@ with gr.Blocks(
330
  .section { background: white; padding: 25px; border-radius: 15px; margin: 15px 0; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
331
  """
332
  ) as app:
333
-
334
  # Header
335
  gr.HTML("""
336
  <div class="header">
@@ -339,72 +339,72 @@ with gr.Blocks(
339
  <p>🧠 Qwen & DeepSeek | πŸ–ΌοΈ Image Processing | 🎡 TTS/STT | πŸ‘€ Face Swap | 🌍 Arabic-English | ☁️ Cloud Integration</p>
340
  </div>
341
  """)
342
-
343
  with gr.Row():
344
  # Authentication Section
345
  with gr.Column(scale=1, elem_classes="section"):
346
  gr.Markdown("## πŸ” Authentication System")
347
-
348
  with gr.Tab("Sign Up"):
349
  gr.Markdown("### Create New Account")
350
  signup_mobile = gr.Textbox(
351
- label="Mobile Number",
352
  placeholder="+1234567890",
353
  info="Enter your mobile number with country code"
354
  )
355
  signup_name = gr.Textbox(
356
- label="Full Name",
357
  placeholder="Your full name"
358
  )
359
  signup_password = gr.Textbox(
360
- label="Password",
361
  type="password",
362
  info="Minimum 6 characters"
363
  )
364
  signup_confirm = gr.Textbox(
365
- label="Confirm Password",
366
  type="password"
367
  )
368
  signup_btn = gr.Button("Create Account", variant="primary")
369
  signup_result = gr.Textbox(
370
- label="Registration Status",
371
  interactive=False,
372
  lines=2
373
  )
374
-
375
  signup_btn.click(
376
  signup_user,
377
  [signup_mobile, signup_name, signup_password, signup_confirm],
378
  signup_result
379
  )
380
-
381
  with gr.Tab("Login"):
382
  gr.Markdown("### Access Your Account")
383
  login_mobile = gr.Textbox(
384
- label="Mobile Number",
385
  placeholder="+1234567890"
386
  )
387
  login_password = gr.Textbox(
388
- label="Password",
389
  type="password"
390
  )
391
  login_btn = gr.Button("Login", variant="primary")
392
  login_result = gr.Textbox(
393
- label="Login Status",
394
  interactive=False,
395
  lines=2
396
  )
397
-
398
  login_btn.click(
399
  login_user,
400
  [login_mobile, login_password],
401
  login_result
402
  )
403
-
404
- # AI Models Section
405
  with gr.Column(scale=2, elem_classes="section"):
406
  gr.Markdown("## πŸ€– AI Models Hub (200+ Models)")
407
-
408
  with gr.Tab("Text Generation"):
409
  with gr.Row():
410
  with gr.Column():
@@ -426,12 +426,12 @@ with gr.Blocks(
426
  interactive=False
427
  )
428
  qwen_btn.click(use_ai_model, [qwen_model, qwen_input], qwen_output)
429
-
430
  with gr.Column():
431
  gr.Markdown("### DeepSeek Models (17 models)")
432
  deepseek_model = gr.Dropdown(
433
  choices=AI_MODELS["Text Generation"]["DeepSeek Models"],
434
- label="Select DeepSeek Model",
435
  value="deepseek-ai/deepseek-llm-67b-chat"
436
  )
437
  deepseek_input = gr.Textbox(
@@ -446,7 +446,7 @@ with gr.Blocks(
446
  interactive=False
447
  )
448
  deepseek_btn.click(use_ai_model, [deepseek_model, deepseek_input], deepseek_output)
449
-
450
  with gr.Tab("Image Processing"):
451
  with gr.Row():
452
  with gr.Column():
@@ -468,7 +468,7 @@ with gr.Blocks(
468
  interactive=False
469
  )
470
  img_gen_btn.click(use_ai_model, [img_gen_model, img_prompt], img_gen_output)
471
-
472
  with gr.Column():
473
  gr.Markdown("### Face Processing & Editing")
474
  face_model = gr.Dropdown(
@@ -488,7 +488,7 @@ with gr.Blocks(
488
  interactive=False
489
  )
490
  face_btn.click(use_ai_model, [face_model, face_input], face_output)
491
-
492
  with gr.Tab("Audio Processing"):
493
  with gr.Row():
494
  with gr.Column():
@@ -510,7 +510,7 @@ with gr.Blocks(
510
  interactive=False
511
  )
512
  tts_btn.click(use_ai_model, [tts_model, tts_text], tts_output)
513
-
514
  with gr.Column():
515
  gr.Markdown("### Speech-to-Text (15 models)")
516
  stt_model = gr.Dropdown(
@@ -530,7 +530,7 @@ with gr.Blocks(
530
  interactive=False
531
  )
532
  stt_btn.click(use_ai_model, [stt_model, stt_input], stt_output)
533
-
534
  with gr.Tab("Multimodal & Avatars"):
535
  with gr.Row():
536
  with gr.Column():
@@ -552,7 +552,7 @@ with gr.Blocks(
552
  interactive=False
553
  )
554
  vl_btn.click(use_ai_model, [vl_model, vl_input], vl_output)
555
-
556
  with gr.Column():
557
  gr.Markdown("### Talking Avatars")
558
  avatar_model = gr.Dropdown(
@@ -572,7 +572,7 @@ with gr.Blocks(
572
  interactive=False
573
  )
574
  avatar_btn.click(use_ai_model, [avatar_model, avatar_input], avatar_output)
575
-
576
  with gr.Tab("Arabic-English"):
577
  gr.Markdown("### Arabic-English Interactive Models (12 models)")
578
  arabic_model = gr.Dropdown(
@@ -592,12 +592,12 @@ with gr.Blocks(
592
  interactive=False
593
  )
594
  arabic_btn.click(use_ai_model, [arabic_model, arabic_input], arabic_output)
595
-
596
  # Services Status Section
597
  with gr.Row():
598
  with gr.Column(elem_classes="section"):
599
  gr.Markdown("## ☁️ Cloudflare Services Integration")
600
-
601
  with gr.Row():
602
  with gr.Column():
603
  gr.Markdown("### Services Status")
@@ -612,7 +612,7 @@ with gr.Blocks(
612
  lambda: get_cloudflare_status(),
613
  outputs=services_status
614
  )
615
-
616
  with gr.Column():
617
  gr.Markdown("### Configuration")
618
  gr.HTML("""
@@ -620,7 +620,7 @@ with gr.Blocks(
620
  <h4>Environment Variables:</h4>
621
  <ul>
622
  <li><code>CLOUDFLARE_API_TOKEN</code> - API authentication</li>
623
- <li><code>CLOUDFLARE_ACCOUNT_ID</code> - Account identifier</li>
624
  <li><code>CLOUDFLARE_D1_DATABASE_ID</code> - D1 database</li>
625
  <li><code>CLOUDFLARE_R2_BUCKET_NAME</code> - R2 storage</li>
626
  <li><code>CLOUDFLARE_KV_NAMESPACE_ID</code> - KV cache</li>
@@ -628,7 +628,7 @@ with gr.Blocks(
628
  </ul>
629
  </div>
630
  """)
631
-
632
  # Footer Status
633
  gr.HTML("""
634
  <div style="background: linear-gradient(45deg, #f0f8ff 0%, #e6f3ff 100%); padding: 20px; border-radius: 15px; margin-top: 25px; text-align: center;">
@@ -649,11 +649,11 @@ with gr.Blocks(
649
 
650
  if __name__ == "__main__":
651
  logger.info("πŸš€ Launching OpenManus Platform...")
652
-
653
  try:
654
  # Initialize database
655
  init_database()
656
-
657
  # Launch with Linux-optimized settings
658
  app.launch(
659
  server_name="0.0.0.0",
@@ -666,4 +666,4 @@ if __name__ == "__main__":
666
  )
667
  except Exception as e:
668
  logger.error(f"Failed to launch application: {e}")
669
- sys.exit(1)
 
132
  # Use Linux-friendly paths
133
  data_dir = Path("/home/user/app/data")
134
  data_dir.mkdir(exist_ok=True)
135
+
136
  db_path = data_dir / "openmanus.db"
137
  logger.info(f"Initializing database at {db_path}")
138
+
139
  conn = sqlite3.connect(str(db_path))
140
  cursor = conn.cursor()
141
+
142
  # Create users table
143
  cursor.execute("""
144
  CREATE TABLE IF NOT EXISTS users (
 
151
  is_active BOOLEAN DEFAULT 1
152
  )
153
  """)
154
+
155
  # Create sessions table
156
  cursor.execute("""
157
  CREATE TABLE IF NOT EXISTS sessions (
 
164
  FOREIGN KEY (user_id) REFERENCES users (id)
165
  )
166
  """)
167
+
168
  # Create model usage table
169
  cursor.execute("""
170
  CREATE TABLE IF NOT EXISTS model_usage (
 
179
  FOREIGN KEY (user_id) REFERENCES users (id)
180
  )
181
  """)
182
+
183
  conn.commit()
184
  conn.close()
185
  logger.info("Database initialized successfully")
186
  return True
187
+
188
  except Exception as e:
189
  logger.error(f"Database initialization failed: {e}")
190
  return False
 
197
  """User registration with mobile number"""
198
  if not all([mobile, name, password, confirm_password]):
199
  return "❌ Please fill in all fields"
200
+
201
  if password != confirm_password:
202
  return "❌ Passwords do not match"
203
+
204
  if len(password) < 6:
205
  return "❌ Password must be at least 6 characters"
206
+
207
  # Validate mobile number
208
  if not mobile.replace("+", "").replace("-", "").replace(" ", "").isdigit():
209
  return "❌ Please enter a valid mobile number"
210
+
211
  try:
212
  conn = sqlite3.connect("openmanus.db")
213
  cursor = conn.cursor()
214
+
215
  # Check if mobile number already exists
216
  cursor.execute("SELECT id FROM users WHERE mobile_number = ?", (mobile,))
217
  if cursor.fetchone():
218
  conn.close()
219
  return "❌ Mobile number already registered"
220
+
221
  # Create new user
222
  password_hash = hash_password(password)
223
  cursor.execute("""
224
  INSERT INTO users (mobile_number, full_name, password_hash)
225
  VALUES (?, ?, ?)
226
  """, (mobile, name, password_hash))
227
+
228
  conn.commit()
229
  conn.close()
230
+
231
  return f"βœ… Account created successfully for {name}! Welcome to OpenManus Platform."
232
+
233
  except Exception as e:
234
  return f"❌ Registration failed: {str(e)}"
235
 
 
237
  """User authentication"""
238
  if not mobile or not password:
239
  return "❌ Please provide mobile number and password"
240
+
241
  try:
242
  conn = sqlite3.connect("openmanus.db")
243
  cursor = conn.cursor()
244
+
245
  # Verify credentials
246
  password_hash = hash_password(password)
247
  cursor.execute("""
248
+ SELECT id, full_name FROM users
249
  WHERE mobile_number = ? AND password_hash = ? AND is_active = 1
250
  """, (mobile, password_hash))
251
+
252
  user = cursor.fetchone()
253
  if user:
254
  # Update last login
 
257
  """, (user[0],))
258
  conn.commit()
259
  conn.close()
260
+
261
  return f"βœ… Welcome back, {user[1]}! Login successful."
262
  else:
263
  conn.close()
264
  return "❌ Invalid mobile number or password"
265
+
266
  except Exception as e:
267
  return f"❌ Login failed: {str(e)}"
268
 
 
270
  """Simulate AI model usage"""
271
  if not input_text.strip():
272
  return "Please enter some text for the AI model to process."
273
+
274
  # Simulate model processing
275
  response_templates = {
276
  "text": f"🧠 {model_name} processed: '{input_text}'\n\n✨ AI Response: This is a simulated response from the {model_name} model. In production, this would connect to the actual model API.",
 
278
  "audio": f"🎡 {model_name} audio processing for: '{input_text}'\n\nπŸ”Š Output: Audio generated/processed (simulated)",
279
  "multimodal": f"πŸ€– {model_name} multimodal processing: '{input_text}'\n\n🎯 Output: Combined AI analysis complete (simulated)"
280
  }
281
+
282
  # Determine response type based on model
283
  if any(x in model_name.lower() for x in ["image", "flux", "diffusion", "face", "avatar"]):
284
  response_type = "image"
285
  elif any(x in model_name.lower() for x in ["tts", "speech", "audio", "whisper", "wav2vec"]):
286
+ response_type = "audio"
287
  elif any(x in model_name.lower() for x in ["vl", "blip", "vision", "talking"]):
288
  response_type = "multimodal"
289
  else:
290
  response_type = "text"
291
+
292
  return response_templates[response_type]
293
 
294
  def get_cloudflare_status():
295
  """Get Cloudflare services status"""
296
  services = []
297
+
298
  if CLOUDFLARE_CONFIG["d1_database_id"]:
299
  services.append("βœ… D1 Database Connected")
300
  else:
301
  services.append("βš™οΈ D1 Database (Configure CLOUDFLARE_D1_DATABASE_ID)")
302
+
303
  if CLOUDFLARE_CONFIG["r2_bucket_name"]:
304
+ services.append("βœ… R2 Storage Connected")
305
  else:
306
  services.append("βš™οΈ R2 Storage (Configure CLOUDFLARE_R2_BUCKET_NAME)")
307
+
308
  if CLOUDFLARE_CONFIG["kv_namespace_id"]:
309
  services.append("βœ… KV Cache Connected")
310
  else:
311
  services.append("βš™οΈ KV Cache (Configure CLOUDFLARE_KV_NAMESPACE_ID)")
312
+
313
  if CLOUDFLARE_CONFIG["durable_objects_id"]:
314
  services.append("βœ… Durable Objects Connected")
315
  else:
316
  services.append("βš™οΈ Durable Objects (Configure CLOUDFLARE_DURABLE_OBJECTS_ID)")
317
+
318
  return "\n".join(services)
319
 
320
  # Initialize database
 
322
 
323
  # Create Gradio interface
324
  with gr.Blocks(
325
+ title="OpenManus - Complete AI Platform",
326
  theme=gr.themes.Soft(),
327
  css="""
328
  .container { max-width: 1400px; margin: 0 auto; }
 
330
  .section { background: white; padding: 25px; border-radius: 15px; margin: 15px 0; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
331
  """
332
  ) as app:
333
+
334
  # Header
335
  gr.HTML("""
336
  <div class="header">
 
339
  <p>🧠 Qwen & DeepSeek | πŸ–ΌοΈ Image Processing | 🎡 TTS/STT | πŸ‘€ Face Swap | 🌍 Arabic-English | ☁️ Cloud Integration</p>
340
  </div>
341
  """)
342
+
343
  with gr.Row():
344
  # Authentication Section
345
  with gr.Column(scale=1, elem_classes="section"):
346
  gr.Markdown("## πŸ” Authentication System")
347
+
348
  with gr.Tab("Sign Up"):
349
  gr.Markdown("### Create New Account")
350
  signup_mobile = gr.Textbox(
351
+ label="Mobile Number",
352
  placeholder="+1234567890",
353
  info="Enter your mobile number with country code"
354
  )
355
  signup_name = gr.Textbox(
356
+ label="Full Name",
357
  placeholder="Your full name"
358
  )
359
  signup_password = gr.Textbox(
360
+ label="Password",
361
  type="password",
362
  info="Minimum 6 characters"
363
  )
364
  signup_confirm = gr.Textbox(
365
+ label="Confirm Password",
366
  type="password"
367
  )
368
  signup_btn = gr.Button("Create Account", variant="primary")
369
  signup_result = gr.Textbox(
370
+ label="Registration Status",
371
  interactive=False,
372
  lines=2
373
  )
374
+
375
  signup_btn.click(
376
  signup_user,
377
  [signup_mobile, signup_name, signup_password, signup_confirm],
378
  signup_result
379
  )
380
+
381
  with gr.Tab("Login"):
382
  gr.Markdown("### Access Your Account")
383
  login_mobile = gr.Textbox(
384
+ label="Mobile Number",
385
  placeholder="+1234567890"
386
  )
387
  login_password = gr.Textbox(
388
+ label="Password",
389
  type="password"
390
  )
391
  login_btn = gr.Button("Login", variant="primary")
392
  login_result = gr.Textbox(
393
+ label="Login Status",
394
  interactive=False,
395
  lines=2
396
  )
397
+
398
  login_btn.click(
399
  login_user,
400
  [login_mobile, login_password],
401
  login_result
402
  )
403
+
404
+ # AI Models Section
405
  with gr.Column(scale=2, elem_classes="section"):
406
  gr.Markdown("## πŸ€– AI Models Hub (200+ Models)")
407
+
408
  with gr.Tab("Text Generation"):
409
  with gr.Row():
410
  with gr.Column():
 
426
  interactive=False
427
  )
428
  qwen_btn.click(use_ai_model, [qwen_model, qwen_input], qwen_output)
429
+
430
  with gr.Column():
431
  gr.Markdown("### DeepSeek Models (17 models)")
432
  deepseek_model = gr.Dropdown(
433
  choices=AI_MODELS["Text Generation"]["DeepSeek Models"],
434
+ label="Select DeepSeek Model",
435
  value="deepseek-ai/deepseek-llm-67b-chat"
436
  )
437
  deepseek_input = gr.Textbox(
 
446
  interactive=False
447
  )
448
  deepseek_btn.click(use_ai_model, [deepseek_model, deepseek_input], deepseek_output)
449
+
450
  with gr.Tab("Image Processing"):
451
  with gr.Row():
452
  with gr.Column():
 
468
  interactive=False
469
  )
470
  img_gen_btn.click(use_ai_model, [img_gen_model, img_prompt], img_gen_output)
471
+
472
  with gr.Column():
473
  gr.Markdown("### Face Processing & Editing")
474
  face_model = gr.Dropdown(
 
488
  interactive=False
489
  )
490
  face_btn.click(use_ai_model, [face_model, face_input], face_output)
491
+
492
  with gr.Tab("Audio Processing"):
493
  with gr.Row():
494
  with gr.Column():
 
510
  interactive=False
511
  )
512
  tts_btn.click(use_ai_model, [tts_model, tts_text], tts_output)
513
+
514
  with gr.Column():
515
  gr.Markdown("### Speech-to-Text (15 models)")
516
  stt_model = gr.Dropdown(
 
530
  interactive=False
531
  )
532
  stt_btn.click(use_ai_model, [stt_model, stt_input], stt_output)
533
+
534
  with gr.Tab("Multimodal & Avatars"):
535
  with gr.Row():
536
  with gr.Column():
 
552
  interactive=False
553
  )
554
  vl_btn.click(use_ai_model, [vl_model, vl_input], vl_output)
555
+
556
  with gr.Column():
557
  gr.Markdown("### Talking Avatars")
558
  avatar_model = gr.Dropdown(
 
572
  interactive=False
573
  )
574
  avatar_btn.click(use_ai_model, [avatar_model, avatar_input], avatar_output)
575
+
576
  with gr.Tab("Arabic-English"):
577
  gr.Markdown("### Arabic-English Interactive Models (12 models)")
578
  arabic_model = gr.Dropdown(
 
592
  interactive=False
593
  )
594
  arabic_btn.click(use_ai_model, [arabic_model, arabic_input], arabic_output)
595
+
596
  # Services Status Section
597
  with gr.Row():
598
  with gr.Column(elem_classes="section"):
599
  gr.Markdown("## ☁️ Cloudflare Services Integration")
600
+
601
  with gr.Row():
602
  with gr.Column():
603
  gr.Markdown("### Services Status")
 
612
  lambda: get_cloudflare_status(),
613
  outputs=services_status
614
  )
615
+
616
  with gr.Column():
617
  gr.Markdown("### Configuration")
618
  gr.HTML("""
 
620
  <h4>Environment Variables:</h4>
621
  <ul>
622
  <li><code>CLOUDFLARE_API_TOKEN</code> - API authentication</li>
623
+ <li><code>CLOUDFLARE_ACCOUNT_ID</code> - Account identifier</li>
624
  <li><code>CLOUDFLARE_D1_DATABASE_ID</code> - D1 database</li>
625
  <li><code>CLOUDFLARE_R2_BUCKET_NAME</code> - R2 storage</li>
626
  <li><code>CLOUDFLARE_KV_NAMESPACE_ID</code> - KV cache</li>
 
628
  </ul>
629
  </div>
630
  """)
631
+
632
  # Footer Status
633
  gr.HTML("""
634
  <div style="background: linear-gradient(45deg, #f0f8ff 0%, #e6f3ff 100%); padding: 20px; border-radius: 15px; margin-top: 25px; text-align: center;">
 
649
 
650
  if __name__ == "__main__":
651
  logger.info("πŸš€ Launching OpenManus Platform...")
652
+
653
  try:
654
  # Initialize database
655
  init_database()
656
+
657
  # Launch with Linux-optimized settings
658
  app.launch(
659
  server_name="0.0.0.0",
 
666
  )
667
  except Exception as e:
668
  logger.error(f"Failed to launch application: {e}")
669
+ sys.exit(1)