Spaces:
Runtime error
Runtime error
Download app.py from shuklaved/Freellmapi: direct link, hf CLI and curl.
- Browser
- Download file 901 Bytes
-
https://huggingface.co/spaces/shuklaved/Freellmapi/resolve/main/app.py
- Command line
-
hf download hf://spaces/shuklaved/Freellmapi/app.py
-
curl -L -o app.py https://huggingface.co/spaces/shuklaved/Freellmapi/resolve/main/app.py
901 Bytes
| import os | |
| import subprocess | |
| import time | |
| import gradio as gr | |
| # Clone and build FreeLLMAPI if it doesn't exist | |
| if not os.path.exists("freellmapi"): | |
| subprocess.run(["git", "clone", "https://github.com/tashfeenahmed/freellmapi.git", "freellmapi"]) | |
| subprocess.run(["npm", "install"], cwd="freellmapi") | |
| subprocess.run(["npm", "run", "build"], cwd="freellmapi") | |
| # Start FreeLLMAPI Node process on port 3000 | |
| env = os.environ.copy() | |
| env["PORT"] = "3000" | |
| env["NODE_ENV"] = "production" | |
| process = subprocess.Popen(["npm", "start"], cwd="freellmapi", env=env) | |
| time.sleep(5) | |
| # Render simple Gradio dashboard wrapper | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# ⚡ FreeLLMAPI Gateway") | |
| gr.Markdown("Your OpenAI-compatible `/v1` endpoint is live on this Space's direct URL.") | |
| gr.HTML('<iframe src="http://localhost:3000" width="100%" height="750px"></iframe>') | |
| demo.launch(server_port=7860) |