iShare commited on
Commit
01f2316
1 Parent(s): dfec6a5

Create FastAPI.py

Browse files
Files changed (1) hide show
  1. FastAPI.py +13 -0
FastAPI.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+
3
+ app = FastAPI()
4
+
5
+ @app.get("/example")
6
+ def example():
7
+ new_final_ai_response = "这是 AIResponse 的内容"
8
+ return {"AIResponse": new_final_ai_response}
9
+
10
+ response = app.test_client().get("/example")
11
+ response_data = response.json()
12
+ ai_response = response_data["AIResponse"]
13
+ print(ai_response)