| 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: |
| |
| result = subprocess.run(['pgrep', '-f', 'arozos'], capture_output=True) |
| if result.returncode != 0: |
| print("Starting ArozOS...") |
| |
| subprocess.Popen([ |
| './arozos', |
| '-port', '7860', |
| '-host', '0.0.0.0' |
| ], cwd='/app') |
| time.sleep(3) |
| return "β
ArozOS started successfully!" |
| else: |
| return "βΉοΈ ArozOS is already running." |
| except Exception as e: |
| return f"β Error starting ArozOS: {str(e)}" |
|
|
| |
| 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() |