import gradio as gr import os import subprocess import time import threading def start_arozos(): """Start ArozOS in the background if not already running""" try: # Check if already running result = subprocess.run(['pgrep', '-f', 'arozos'], capture_output=True) if result.returncode != 0: print("Starting ArozOS...") # Start in background subprocess.Popen([ './arozos', '-port', '7860', '-host', '0.0.0.0' ], cwd='/app') time.sleep(3) # Wait for startup return "✅ ArozOS started successfully!" else: return "â„šī¸ ArozOS is already running." except Exception as e: return f"❌ Error starting ArozOS: {str(e)}" # Try to start automatically on load try: start_arozos() except: pass with gr.Blocks(title="ArozOS Desktop") as demo: gr.Markdown(""" # đŸ–Ĩī¸ ArozOS Web Desktop **Status:** Running on Hugging Face Spaces ## How to Access 1. Click the **"Open in New Tab"** button at the top right of this page. 2. You will see the ArozOS login/setup screen. 3. Create your admin account and enjoy! ## âš ī¸ Important Notes for Free Tier - **Storage is Ephemeral**: Files will be deleted when the Space restarts or sleeps. - **Cold Start**: If the Space is idle, it may take 1-2 minutes to wake up. - **No Hardware Access**: System monitoring features are disabled due to sandboxing. ## Features - 📁 File Manager - đŸŽĩ Media Player - 📝 Code Editor - 🌐 Web Server - 🔧 Terminal Enjoy your web-based OS! 🚀 """) gr.Button("Refresh Status", variant="primary").click( fn=start_arozos, outputs=gr.Textbox(label="Status") ) if __name__ == "__main__": demo.launch()