Spaces:
Sleeping
Sleeping
File size: 479 Bytes
05c764f 203ca02 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def read_root():
return {"message": "Hello, World mohammad!"}
# from fastapi import FastAPI
from pydantic import BaseModel
# app = FastAPI()
# Define a Pydantic model for the request body
class Item(BaseModel):
name: str
description: str = None
price: float
tax: float = None
@app.post("/items/")
def create_item(item: Item):
return {"item": item, "message": "Hello, World mohammad!"} |