Commit 7c07f8b2 authored by novelailab's avatar novelailab

basic FASTAPI app

parent c210eaf9
from fastapi import FastAPI
from pydantic import BaseModel
from fastapi.responses import HTMLResponse
app = FastAPI()
@app.on_event("startup")
async def startup_event():
print('Start')
@app.on_event("shutdown")
async def shutdown_event():
print('Shutdown')
@app.get("/", response_class=HTMLResponse)
def root():
return "OK"
class GenerationRequest(BaseModel):
prompt: str
n_samples: int = 1
steps: int = 50
class GenerationOutput(BaseModel):
generation: str
version: int = 1
@app.post('/generate', response_model=GenerationOutput)
def generate(request: GenerationRequest):
return {"generation": "Hello World"}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment