Spaces:
Runtime error
Runtime error
Commit
·
5a4bbb8
1
Parent(s):
a9621b1
add files for huggingface
Browse files- Dockerfile +20 -0
- requirements.txt +3 -0
- src/__pycache__/main.cpython-311.pyc +0 -0
- src/main.py +12 -0
Dockerfile
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the official Python base image for FastAPI
|
2 |
+
FROM python:3.11-slim
|
3 |
+
|
4 |
+
# Set the working directory in the container
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy the requirements file into the container
|
8 |
+
COPY requirements.txt /app/
|
9 |
+
|
10 |
+
# Install any needed packages specified in requirements.txt
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
# Copy the entire src directory into the container
|
14 |
+
COPY src/ /app/src/
|
15 |
+
|
16 |
+
# Expose the port that your FastAPI application will run on (default is 8000)
|
17 |
+
EXPOSE 8000
|
18 |
+
|
19 |
+
# Define the command to run your FastAPI application
|
20 |
+
CMD ["uvicorn", "src.main:app", "--host", "0.0.0.0", "--port", "8000", "--reload"]
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
fastapi==0.95.0
|
3 |
+
uvicorn[standard]==0.21.1
|
src/__pycache__/main.cpython-311.pyc
ADDED
Binary file (804 Bytes). View file
|
|
src/main.py
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
from fastapi import FastAPI
|
3 |
+
|
4 |
+
app = FastAPI()
|
5 |
+
|
6 |
+
@app.get("/")
|
7 |
+
def read_root():
|
8 |
+
return {"message": "Hello, World!"}
|
9 |
+
|
10 |
+
@app.get("/items/{item_id}")
|
11 |
+
def read_item(item_id:int,q: str = None):
|
12 |
+
return {"items_id": item_id, "q":q}
|