vxrachit commited on
Commit
0faa2f9
·
verified ·
1 Parent(s): 7e698de

Upload 4 files

Browse files
Files changed (4) hide show
  1. Dockerfile +12 -0
  2. README.md +16 -10
  3. main.py +11 -0
  4. 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"]
README.md CHANGED
@@ -1,10 +1,16 @@
1
- ---
2
- title: Fastapi Hf
3
- emoji: 🌖
4
- colorFrom: yellow
5
- colorTo: blue
6
- sdk: docker
7
- pinned: false
8
- ---
9
-
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
1
+ ---
2
+ title: FastAPI Health API
3
+ emoji: 🚀
4
+ colorFrom: blue
5
+ colorTo: purple
6
+ sdk: docker
7
+ app_port: 7860
8
+ ---
9
+
10
+ # FastAPI Docker Backend
11
+
12
+ Simple FastAPI app deployed on Hugging Face Spaces.
13
+
14
+ ## Endpoints
15
+ - `/`
16
+ - `/health`
main.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+
3
+ app = FastAPI()
4
+
5
+ @app.get("/")
6
+ def root():
7
+ return {"message": "FastAPI running successfully!"}
8
+
9
+ @app.get("/health")
10
+ def health():
11
+ return {"status": "ok"}
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastapi==0.110.0
2
+ uvicorn[standard]==0.29.0