Spaces:
Paused
Paused
from fastapi import FastAPI | |
from pydantic import BaseModel | |
import random | |
app = FastAPI() | |
class ResourceItem(BaseModel): | |
name: str | |
description: str | None = None | |
def read_root(): | |
return {"Hello": "World!"} | |
def return_random(): | |
return {"Random number":int(random.random()*100)} | |
def return_received(item: ResourceItem): | |
return {'name':item.name, | |
'description':item.description} |