Spaces:
Runtime error
Runtime error
test
Browse files
main.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
# https://medium.com/@qacheampong/building-and-deploying-a-fastapi-app-with-hugging-face-9210e9b4a713
|
| 2 |
# https://huggingface.co/spaces/Queensly/FastAPI_in_Docker
|
| 3 |
|
| 4 |
-
from fastapi import FastAPI
|
| 5 |
import uvicorn
|
| 6 |
|
| 7 |
app = FastAPI()
|
|
@@ -13,9 +13,8 @@ app = FastAPI()
|
|
| 13 |
def root():
|
| 14 |
return {"API": "Sum of 2 Squares"}
|
| 15 |
|
| 16 |
-
@app.
|
| 17 |
-
def predict():
|
| 18 |
-
|
| 19 |
prompt = request.json.get('prompt')
|
| 20 |
return "你好啊"+prompt
|
| 21 |
|
|
|
|
| 1 |
# https://medium.com/@qacheampong/building-and-deploying-a-fastapi-app-with-hugging-face-9210e9b4a713
|
| 2 |
# https://huggingface.co/spaces/Queensly/FastAPI_in_Docker
|
| 3 |
|
| 4 |
+
from fastapi import FastAPI,Request
|
| 5 |
import uvicorn
|
| 6 |
|
| 7 |
app = FastAPI()
|
|
|
|
| 13 |
def root():
|
| 14 |
return {"API": "Sum of 2 Squares"}
|
| 15 |
|
| 16 |
+
@app.post("/predict")
|
| 17 |
+
def predict(request: Request):
|
|
|
|
| 18 |
prompt = request.json.get('prompt')
|
| 19 |
return "你好啊"+prompt
|
| 20 |
|