Download main.py from sushruthsam/sql34b_quantized_deployment: direct link, hf CLI and curl.
- Browser
- Download file 526 Bytes
-
https://huggingface.co/spaces/sushruthsam/sql34b_quantized_deployment/resolve/main/main.py
- Command line
-
hf download hf://spaces/sushruthsam/sql34b_quantized_deployment/main.py
-
curl -L -o main.py https://huggingface.co/spaces/sushruthsam/sql34b_quantized_deployment/resolve/main/main.py
526 Bytes
| from ctransformers import AutoModelForCausalLM | |
| from fastapi import FastAPI | |
| from pydantic import BaseModel | |
| # Model loading with the new model name | |
| llm = AutoModelForCausalLM.from_pretrained("sqlcoder-7b.Q4_K_S.gguf") | |
| class Validation(BaseModel): | |
| prompt: str # Assuming this includes both user_question and table_metadata_string | |
| app = FastAPI() | |
| async def generate_sql(item: Validation): | |
| # Format the actual prompt using item.prompt | |
| completion = llm(item.prompt) | |
| return completion | |