Bootstrap: README.md
Browse files123456789101112131415---title: Turingdna Assistantemoji: πcolorFrom: graycolorTo: yellowsdk: gradiosdk_version: 6.14.0python_version: '3.12'app_file: app.pypinned: falselicense: mitshort_description: Biomedical LLM backend for TuringDNA---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108---title: TuringDNA Assistantemoji: π§¬colorFrom: graycolorTo: bluesdk: gradiosdk_version: 4.44.0app_file: app.pypinned: falselicense: apache-2.0hardware: zero-a10gshort_description: Protein biology Q&A backend for the TuringDNA engine.suggested_hardware: zero-a10g---# TuringDNA AssistantSelf-hosted biomedical LLM that powers the in-app chat panel on[turingdna.com/app](https://turingdna.com/app). Loads **BioMistral-7B**(an open-source Mistral fine-tuned on biomedical corpora) on aZeroGPU-shared NVIDIA A100, exposes a Gradio `ChatInterface` for directtesting, and an auto-generated `/run/predict` API the Flask app callsvia `gradio_client`.## Architecture```ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ winter4000/syntheogenesis (Flask + vanilla JS, CPU) ββ βββ dee/server.py /api/chat ββ βββ gradio_client.predict() βββββββββββββββββββββββββββ βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββΌββββββββΌββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ winter4000/turingdna-assistant (Gradio, ZeroGPU) ββ βββ app.py Gradio ChatInterface ββ βββ llm.py BioMistral-7B in bf16, @spaces.GPU(duration=60) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ```Two-Space split so the existing Flask engine doesn't need a rewrite andthe model lives where the GPU does.## Why ZeroGPU?ZeroGPU gives shared A100 access to HF PRO subscribers at no per-hourcost (just the $9/mo subscription). The decorator pattern:- Model loads on CPU at import (~14 GB in bf16, fits comfortably inZeroGPU's 60 GB host RAM)- `@spaces.GPU(duration=60)` moves the model to GPU only during ageneration call, then releases β so we share the A100 efficientlywith other ZeroGPU SpacesFirst call after the Space wakes up: ~10β30 s (cold-start + GPU acquire).Subsequent calls: ~25β80 tokens/sec.## Model[BioMistral/BioMistral-7B](https://huggingface.co/BioMistral/BioMistral-7B)β Apache-2.0, biomedical-domain fine-tune of Mistral-7B-Instruct-v0.1.Knows enzyme mechanisms, active sites, conserved domains, codonoptimization, expression systems, and cloning vocab better than vanillaMistral. Same Mistral instruct template (`[INST] ... [/INST]`).Fallback if BioMistral fetch fails: `mistralai/Mistral-7B-Instruct-v0.2`.## System promptBaked into `llm.py`. The assistant is told it's the chat backend forTuringDNA, knows the codebase's ΞLL sign convention (positive ΞLL =mutation is MORE likely than WT under ESM-2, i.e. more tolerated;negative = less likely, i.e. disruptive), and is instructed to beconcise + not hallucinate domain boundaries.## Local development```bashpip install -r requirements.txtpython app.py```Local runs use CPU-only fp16 (~2 tok/s on Mac M1, ~1 tok/s on IntelMac). Production runs on ZeroGPU A100. The `@spaces.GPU` decoratoris a no-op locally so the same code works in both contexts.## Calling from outside```pythonfrom gradio_client import Clientclient = Client("winter4000/turingdna-assistant")response = client.predict(message="What does a ΞLL of +1.2 for V8L mean?",history=[],api_name="/chat",)print(response)```## Files- `app.py` β Gradio app entry (ChatInterface + Gradio launches its ownAPI endpoints)- `llm.py` β model loading + Mistral prompt formatting + ZeroGPUinference function- `requirements.txt` β Gradio, transformers, spaces, torch, accelerate- `README.md` β this file (also the HF Space metadata via YAMLfrontmatter at the top)
README.md+101-8