michaelj's picture
test
faf9078
raw
history blame
No virus
620 Bytes
# https://medium.com/@qacheampong/building-and-deploying-a-fastapi-app-with-hugging-face-9210e9b4a713
# https://huggingface.co/spaces/Queensly/FastAPI_in_Docker
from fastapi import FastAPI,Request
import uvicorn
import json
app = FastAPI()
#Endpoints
#Root endpoints
@app.get("/")
def root():
return {"API": "Sum of 2 Squares"}
@app.post("/img2img")
async def predict(url:str,prompt:str):
return f"您好,{url+prompt}"
@app.post("/predict")
async def predict(request:Request):
body = await request.body()
data = json.loads(body)
prompt = data.get("prompt")
return f"您好,{prompt}"