Download src/main.py from budaya-lab/exai-vis.grc-backend: direct link, hf CLI and curl.
- Browser
- Download file 615 Bytes
-
https://huggingface.co/spaces/budaya-lab/exai-vis.grc-backend/resolve/main/src/main.py
- Command line
-
hf download hf://spaces/budaya-lab/exai-vis.grc-backend/src/main.py
-
curl -L -o main.py https://huggingface.co/spaces/budaya-lab/exai-vis.grc-backend/resolve/main/src/main.py
615 Bytes
| from fastapi import FastAPI | |
| from fastapi.middleware.cors import CORSMiddleware | |
| from src.grc import process_grc | |
| from src.ml import model, tokenizer | |
| from src.models import ProcessGrcInput | |
| import os | |
| app = FastAPI(title="GRC API") | |
| origins = [os.environ.get("FRONTEND_ORIGIN", "")] | |
| app.add_middleware( | |
| CORSMiddleware, | |
| allow_origins=origins, | |
| allow_credentials=True, | |
| allow_methods=["*"], | |
| allow_headers=["*"], | |
| ) | |
| def index(): | |
| return "Welcome to the GRC API" | |
| def run(input: ProcessGrcInput): | |
| return process_grc(model=model, tokenizer=tokenizer, input=input) | |