Spaces:
Sleeping
Sleeping
Download run_app.py from KrishDev15/Sign_intrepreter: direct link, hf CLI and curl.
- Browser
- Download file 3.01 kB
-
https://huggingface.co/spaces/KrishDev15/Sign_intrepreter/resolve/main/run_app.py
- Command line
-
hf download hf://spaces/KrishDev15/Sign_intrepreter/run_app.py
-
curl -L -o run_app.py https://huggingface.co/spaces/KrishDev15/Sign_intrepreter/resolve/main/run_app.py
3.01 kB
| #!/usr/bin/env python3 | |
| """ | |
| Startup script for AI Sign Language Interpreter | |
| This script starts both the landing page (Flask) and the main app (Streamlit) | |
| """ | |
| import subprocess | |
| import threading | |
| import time | |
| import webbrowser | |
| import sys | |
| import os | |
| def start_streamlit(): | |
| """Start Streamlit app""" | |
| print("π Starting Streamlit app...") | |
| try: | |
| subprocess.run([ | |
| sys.executable, '-m', 'streamlit', 'run', 'app_enhanced.py', | |
| '--server.port=8502', | |
| '--server.headless=true', | |
| '--server.runOnSave=true' | |
| ]) | |
| except KeyboardInterrupt: | |
| print("Streamlit app stopped.") | |
| except Exception as e: | |
| print(f"Error starting Streamlit: {e}") | |
| def start_flask(): | |
| """Start Flask server for landing page""" | |
| print("π Starting Flask server...") | |
| try: | |
| subprocess.run([sys.executable, 'server.py']) | |
| except KeyboardInterrupt: | |
| print("Flask server stopped.") | |
| except Exception as e: | |
| print(f"Error starting Flask: {e}") | |
| def main(): | |
| print("=" * 60) | |
| print("π€ AI Sign Language Interpreter") | |
| print("=" * 60) | |
| print("Starting application servers...") | |
| print() | |
| # Check if required files exist | |
| required_files = ['app_enhanced.py', 'server.py', 'models/model.tflite', 'models/labels.txt'] | |
| missing_files = [f for f in required_files if not os.path.exists(f)] | |
| if missing_files: | |
| print("β Missing required files:") | |
| for file in missing_files: | |
| print(f" - {file}") | |
| print("\nPlease ensure all required files are present.") | |
| return | |
| print("β All required files found.") | |
| print() | |
| try: | |
| # Start Streamlit in a separate thread | |
| streamlit_thread = threading.Thread(target=start_streamlit, daemon=True) | |
| streamlit_thread.start() | |
| # Give Streamlit time to start | |
| print("β³ Waiting for Streamlit to initialize...") | |
| time.sleep(5) | |
| # Start Flask (this will block) | |
| print("π Flask server starting on http://localhost:5000") | |
| print("π€ Streamlit app available on http://localhost:8501") | |
| print() | |
| print("π Instructions:") | |
| print(" 1. Visit http://localhost:5000 for the landing page") | |
| print(" 2. Click 'Try it Out' to access the AI interpreter") | |
| print(" 3. Allow camera access when prompted") | |
| print(" 4. Start making sign language gestures!") | |
| print() | |
| print("Press Ctrl+C to stop all servers") | |
| print("=" * 60) | |
| # Open browser automatically | |
| time.sleep(2) | |
| webbrowser.open('http://localhost:5000') | |
| # Start Flask server | |
| start_flask() | |
| except KeyboardInterrupt: | |
| print("\nπ Shutting down servers...") | |
| print("π Thank you for using AI Sign Language Interpreter!") | |
| except Exception as e: | |
| print(f"β Error: {e}") | |
| if __name__ == "__main__": | |
| main() | |