FastAPIBasics / FastAPI.py
iShare's picture
Create FastAPI.py
01f2316
raw
history blame contribute delete
328 Bytes
from fastapi import FastAPI
app = FastAPI()
@app.get("/example")
def example():
new_final_ai_response = "这是 AIResponse 的内容"
return {"AIResponse": new_final_ai_response}
response = app.test_client().get("/example")
response_data = response.json()
ai_response = response_data["AIResponse"]
print(ai_response)