Spaces:
Paused
Paused
Daniel Marques
commited on
Commit
•
6229292
1
Parent(s):
23c348d
feat: add fastapi
Browse files
main.py
CHANGED
@@ -68,16 +68,18 @@ class Predict(BaseModel):
|
|
68 |
prompt: str
|
69 |
|
70 |
app = FastAPI()
|
|
|
71 |
|
72 |
app.mount("/", StaticFiles(directory="static",html = True), name="static")
|
|
|
73 |
|
74 |
# @app.get("/")
|
75 |
# def read_root():
|
76 |
# return {"Hello": "World"}
|
77 |
|
78 |
-
app.mount("/static", StaticFiles(directory="static"), name="static")
|
79 |
|
80 |
-
@
|
81 |
async def predict(data: Predict):
|
82 |
input_prompt = data.prompt
|
83 |
user_prompt = system_message + " " + input_prompt
|
|
|
68 |
prompt: str
|
69 |
|
70 |
app = FastAPI()
|
71 |
+
api_app = FastAPI(title="api app")
|
72 |
|
73 |
app.mount("/", StaticFiles(directory="static",html = True), name="static")
|
74 |
+
app.mount("/api", api_app)
|
75 |
|
76 |
# @app.get("/")
|
77 |
# def read_root():
|
78 |
# return {"Hello": "World"}
|
79 |
|
80 |
+
# app.mount("/static", StaticFiles(directory="static"), name="static")
|
81 |
|
82 |
+
@api_app.post('/predict')
|
83 |
async def predict(data: Predict):
|
84 |
input_prompt = data.prompt
|
85 |
user_prompt = system_message + " " + input_prompt
|