Spaces:
Sleeping
Sleeping
Upload api.py
Browse files
api.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastapi import FastAPI
|
2 |
+
from fastapi.responses import HTMLResponse
|
3 |
+
|
4 |
+
app = FastAPI()
|
5 |
+
|
6 |
+
@app.get("/", response_class=HTMLResponse)
|
7 |
+
async def read_root():
|
8 |
+
html_content = """
|
9 |
+
<html>
|
10 |
+
<head>
|
11 |
+
<title>My FastAPI App</title>
|
12 |
+
</head>
|
13 |
+
<body>
|
14 |
+
<h1>Hello from FastAPI!</h1>
|
15 |
+
<p>This is a sample application running on Hugging Face Spaces.</p>
|
16 |
+
</body>
|
17 |
+
</html>
|
18 |
+
"""
|
19 |
+
return html_content
|