File size: 1,525 Bytes
ccb935d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""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)