--- title: Modular Detector V2 emoji: 🧭 colorFrom: indigo colorTo: blue sdk: docker pinned: false license: mit short_description: Modular addition helper. --- Local run: ```bash python -m venv .venv source .venv/bin/activate pip install -r requirements.txt uvicorn app.main:app --reload ``` Open http://127.0.0.1:8000 Default embedding model: `Qwen/Qwen3-Embedding-0.6B` Default dataset: `Molbap/modular-detector-embeddings` Note: The embedding model and the index must match. If you change the model, you must rebuild and re-upload the index. Rebuild method index (from repo root, expects transformers clone at `./transformers` or `./transformers_repo`): ```bash python scripts/build_index.py ``` Quick inference (curl): ```bash curl -s http://127.0.0.1:8000/api/analyze \ -H "Content-Type: application/json" \ -d '{ "code": "class Foo:\n def forward(self,x):\n return x\n", "top_k": 5, "granularity": "method", "precision": "float32" }' | jq ``` Push app to Space: ```bash hf upload --repo-type space Molbap/modular-detector-v2 . \ --include "Dockerfile" \ --include "requirements.txt" \ --include "README.md" \ --include "app/**" \ --include "static/**" \ --commit-message "Update app" ``` Push method index to dataset: ```bash hf upload --repo-type dataset Molbap/modular-detector-embeddings . \ --include "embeddings_methods.safetensors" \ --include "code_index_map_methods.json" \ --include "code_index_tokens_methods.json" \ --commit-message "Update method index" ```