clove1002 Claude Sonnet 4.6 commited on
Commit
3668c2d
·
1 Parent(s): 7ad73c9

Add FastAPI app with Dockerfile for HF Spaces

Browse files

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (3) hide show
  1. Dockerfile +12 -0
  2. main.py +12 -0
  3. requirements.txt +2 -0
Dockerfile ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.11-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY requirements.txt .
6
+ RUN pip install --no-cache-dir -r requirements.txt
7
+
8
+ COPY . .
9
+
10
+ EXPOSE 7860
11
+
12
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
main.py ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+ from fastapi.responses import FileResponse
3
+
4
+ app = FastAPI(title="ZHSAPI")
5
+
6
+ @app.get("/")
7
+ def root():
8
+ return FileResponse("index.html")
9
+
10
+ @app.get("/health")
11
+ def health():
12
+ return {"status": "ok"}
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastapi
2
+ uvicorn[standard]