sh20raj commited on
Commit
14c36bc
·
1 Parent(s): 8f67f20
Files changed (5) hide show
  1. .DS_Store +0 -0
  2. .gitignore +2 -0
  3. Dockerfile +9 -0
  4. app.py +16 -0
  5. requirements.txt +2 -0
.DS_Store ADDED
Binary file (6.15 kB). View file
 
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ __pycache__
2
+ venv
Dockerfile ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ COPY . /app
6
+
7
+ RUN pip install -r requirements.txt
8
+
9
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from fastapi import FastAPI
2
+
3
+ app = FastAPI()
4
+
5
+ # Define a route
6
+ @app.get("/api/greet")
7
+ def greet(name: str = "World"):
8
+ return {"message": f"Hello, {name}!"}
9
+
10
+ # Run the server (use Uvicorn)
11
+ # Command: uvicorn app:app --reload
12
+
13
+ @app.get("/")
14
+ def read_root():
15
+ return {"message": "Hello from Hugging Face Spaces!"}
16
+
requirements.txt ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ fastapi
2
+ uvicorn