File size: 354 Bytes
f655296
65afda8
 
f655296
65afda8
 
 
 
 
 
f655296
 
65afda8
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from fastapi import FastAPI
from qwen_classifier.predict import predict_single  # Your existing function
import torch

app = FastAPI(title="Qwen Classifier")

@app.on_event("startup")
async def load_model():
    # Warm up GPU
    torch.zeros(1).cuda() 

@app.post("/predict")
async def predict(text: str):
    return predict_single(text, backend="local")