Spaces:
Runtime error
Runtime error
update
Browse files
main.py
CHANGED
|
@@ -3,12 +3,25 @@
|
|
| 3 |
from fastapi import FastAPI
|
| 4 |
from PIL import Image
|
| 5 |
import base64
|
|
|
|
| 6 |
|
| 7 |
app = FastAPI()
|
| 8 |
|
| 9 |
@app.get("/")
|
| 10 |
async def root():
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
@app.get("/api")
|
| 14 |
async def cal_api():
|
|
|
|
| 3 |
from fastapi import FastAPI
|
| 4 |
from PIL import Image
|
| 5 |
import base64
|
| 6 |
+
from fastapi.responses import HTMLResponse
|
| 7 |
|
| 8 |
app = FastAPI()
|
| 9 |
|
| 10 |
@app.get("/")
|
| 11 |
async def root():
|
| 12 |
+
"""Basic HTML response."""
|
| 13 |
+
body = (
|
| 14 |
+
"<html>"
|
| 15 |
+
"<body style='padding: 10px;'>"
|
| 16 |
+
"<h1>Welcome to the API</h1>"
|
| 17 |
+
"<div>"
|
| 18 |
+
"Check the docs: <a href='/docs'>here</a>"
|
| 19 |
+
"</div>"
|
| 20 |
+
"</body>"
|
| 21 |
+
"</html>"
|
| 22 |
+
)
|
| 23 |
+
|
| 24 |
+
return HTMLResponse(content=body)
|
| 25 |
|
| 26 |
@app.get("/api")
|
| 27 |
async def cal_api():
|