arozos / app.py
mwask's picture
Create app.py
7b9d6ee verified
Raw
History Blame Contribute Delete
1.9 kB
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()