Spaces:
Running
Running
| """SoniCoder β entry point. | |
| Uses MiniCPM5-1B (text) or MiniCPM-V-4.6 (vision+text) for local inference. | |
| No external APIs required. | |
| Supports generating fullstack applications in any language. | |
| Can push generated projects to HuggingFace Hub. | |
| Web search via Google scraping (no API keys needed). | |
| Gradio app support for Python. | |
| Image understanding with MiniCPM-V-4.6. | |
| Project structure: | |
| code/ | |
| βββ config/constants.py App constants, model configs, system prompt | |
| βββ model/loader.py Dual model loading & switching | |
| βββ model/inference.py Streaming inference (text + VLM) | |
| βββ execution/code_extractor.py Code extraction & language normalization | |
| βββ execution/python_runner.py Sandboxed Python execution | |
| βββ execution/gradio_runner.py Gradio app subprocess runner | |
| βββ websearch/google_scraper.py Web search scraping (no API) | |
| βββ huggingface/push.py HuggingFace Hub push & ZIP packaging | |
| βββ server/chat_helpers.py Chat history & prompt building | |
| βββ server/routes.py FastAPI / Gradio server routes | |
| """ | |
| from __future__ import annotations | |
| import logging | |
| from code.model.loader import start_background_load | |
| from code.server.routes import get_app | |
| logging.basicConfig(level=logging.INFO) | |
| logger = logging.getLogger(__name__) | |
| # Start loading default model in background | |
| start_background_load() | |
| # Launch the server | |
| application = get_app() | |
| application.launch(show_error=True) | |