File size: 469 Bytes
650149e
 
 
 
 
 
 
 
 
 
 
 
 
 
6de89fc
 
650149e
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI(title="SAM_MedTesting")

class GenerationRequest(BaseModel):
    prompt: str
    max_new_tokens: int = 50

class GenerationResponse(BaseModel):
    generated_text: str

@app.post("/generate", response_model=GenerationResponse)
def generate(req: GenerationRequest):
    out = f"hello world: {req}"
    return out

@app.get("/health")
def health():
    return {"status": "ok"}