shapi / app.py
sh20raj's picture
API Init
14c36bc
raw
history blame
319 Bytes
from fastapi import FastAPI
app = FastAPI()
# Define a route
@app.get("/api/greet")
def greet(name: str = "World"):
return {"message": f"Hello, {name}!"}
# Run the server (use Uvicorn)
# Command: uvicorn app:app --reload
@app.get("/")
def read_root():
return {"message": "Hello from Hugging Face Spaces!"}