itazap/modular-detector-v2
0
Local run:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reloadOpen 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):
python scripts/build_index.pyQuick inference (curl):
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"
}' | jqPush app to Space:
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:
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"