CoolFace
Apppublic

mano96/Fast-API

sourceHugging Faceupdated 4y agoView on Hugging Face
0likes
app.py20 linesDownload Raw Back to root
1from fastapi import FastAPI2from fastapi.responses import HTMLResponse3 4app = FastAPI()5 6 7@app.get("/")8def home():9    html_content = open('index.html').read()10    return HTMLResponse(content=html_content, status_code=200)11 12 13@app.get("/hello")14def hello():15    return {"hello": "world"}16 17 18@app.get("/hello/{name}")19def greet(name):20    return {"greeting": f"Hello {name}!"}