Spaces:
Sleeping
Sleeping
Commit
·
87a5d7a
1
Parent(s):
e32f70b
Update app.py
Browse files
app.py
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from fastapi import FastAPI
|
| 2 |
+
|
| 3 |
+
import uvicorn
|
| 4 |
+
from config import api_parameter
|
| 5 |
+
from datetime import datetime
|
| 6 |
+
from model_config import console_chat
|
| 7 |
+
|
| 8 |
+
|
| 9 |
+
# Get time
|
| 10 |
+
date = datetime.now().strftime("%d-%m")
|
| 11 |
+
app = FastAPI()
|
| 12 |
+
object = "runServer/app"
|
| 13 |
+
|
| 14 |
+
|
| 15 |
+
# FastAPI
|
| 16 |
+
@app.get("/")
|
| 17 |
+
def read_root():
|
| 18 |
+
return f"Version {date}"
|
| 19 |
+
|
| 20 |
+
@app.post("/")
|
| 21 |
+
def return_api(text: str):
|
| 22 |
+
# Get the caption
|
| 23 |
+
print(text)
|
| 24 |
+
response= console_chat.chat(text)
|
| 25 |
+
print(response)
|
| 26 |
+
|
| 27 |
+
# Return message
|
| 28 |
+
return response
|
| 29 |
+
|
| 30 |
+
# uvicorn.run(app, host=api_parameter.ip, port=int(api_parameter.port))
|