Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -499,4 +499,44 @@ def create_main_interface():
|
|
499 |
**Optimization for Hugging Face Spaces:**
|
500 |
- ☁️ Cloudflare TURN servers for reliable connectivity
|
501 |
- 🔧 Automatic resource management and cleanup
|
502 |
-
- ⏱️ Session timeout prot
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
499 |
**Optimization for Hugging Face Spaces:**
|
500 |
- ☁️ Cloudflare TURN servers for reliable connectivity
|
501 |
- 🔧 Automatic resource management and cleanup
|
502 |
+
- ⏱️ Session timeout prot""")
|
503 |
+
|
504 |
+
# Wire up the interface
|
505 |
+
connect_btn.click(fn=handle_connect, outputs=[status_display])
|
506 |
+
|
507 |
+
screen_btn.click(fn=handle_screen_share, outputs=[status_display], _js=enhanced_screen_share_js)
|
508 |
+
|
509 |
+
disconnect_btn.click(fn=handle_disconnect, outputs=[status_display])
|
510 |
+
|
511 |
+
return demo
|
512 |
+
|
513 |
+
|
514 |
+
# Main execution
|
515 |
+
if __name__ == "__main__":
|
516 |
+
print("🖥️ Enhanced Real-Time Screen Assistant")
|
517 |
+
print("=" * 55)
|
518 |
+
|
519 |
+
if not API_KEY:
|
520 |
+
print("⚠️ CRITICAL: No GEMINI_API_KEY environment variable found!")
|
521 |
+
print("Please set your Google AI API key:")
|
522 |
+
print("export GEMINI_API_KEY='your-api-key-here'")
|
523 |
+
print("\nGet your API key at: https://makersuite.google.com/app/apikey")
|
524 |
+
else:
|
525 |
+
print(f"✅ API key configured (length: {len(API_KEY)})")
|
526 |
+
|
527 |
+
print("\n🔧 Initializing enhanced components...")
|
528 |
+
print("- FastRTC with voice activity detection")
|
529 |
+
print("- Google GenAI Live API integration")
|
530 |
+
print("- Cloudflare TURN server configuration")
|
531 |
+
print("- Enhanced screen sharing capabilities")
|
532 |
+
|
533 |
+
try:
|
534 |
+
demo = create_main_interface()
|
535 |
+
|
536 |
+
print("\n🚀 Launching enhanced interface...")
|
537 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, share=False, show_error=True, enable_queue=True)
|
538 |
+
|
539 |
+
except Exception as e:
|
540 |
+
print(f"\n❌ Failed to launch: {e}")
|
541 |
+
print("Check that all dependencies are installed:")
|
542 |
+
print("pip install -r requirements.txt")
|