Spaces:
Sleeping
Sleeping
Commit
·
c8fcc48
1
Parent(s):
eed5e98
first commit
Browse files- .gitignore +2 -0
- Dockerfile +14 -0
- main.py +15 -0
- requirements.txt +36 -0
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
.venv/
|
Dockerfile
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
|
| 2 |
+
# you will also find guides on how best to write your Dockerfile
|
| 3 |
+
|
| 4 |
+
FROM python:3.9
|
| 5 |
+
|
| 6 |
+
WORKDIR /code
|
| 7 |
+
|
| 8 |
+
COPY ./requirements.txt /code/requirements.txt
|
| 9 |
+
|
| 10 |
+
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
|
| 11 |
+
|
| 12 |
+
COPY . .
|
| 13 |
+
|
| 14 |
+
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]
|
main.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from typing import Union
|
| 2 |
+
from fastapi import FastAPI
|
| 3 |
+
|
| 4 |
+
|
| 5 |
+
app = FastAPI()
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
@app.get("/")
|
| 9 |
+
def read_root():
|
| 10 |
+
return {"Hello": "World"}
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
@app.get("/items/{item_id}")
|
| 14 |
+
def read_item(item_id: int, q: Union[str, None] = None):
|
| 15 |
+
return {"item_id": item_id, "q": q}
|
requirements.txt
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
annotated-types==0.7.0
|
| 2 |
+
anyio==4.3.0
|
| 3 |
+
certifi==2024.2.2
|
| 4 |
+
click==8.1.7
|
| 5 |
+
dnspython==2.6.1
|
| 6 |
+
email_validator==2.1.1
|
| 7 |
+
exceptiongroup==1.2.1
|
| 8 |
+
fastapi==0.111.0
|
| 9 |
+
fastapi-cli==0.0.4
|
| 10 |
+
h11==0.14.0
|
| 11 |
+
httpcore==1.0.5
|
| 12 |
+
httptools==0.6.1
|
| 13 |
+
httpx==0.27.0
|
| 14 |
+
idna==3.7
|
| 15 |
+
Jinja2==3.1.4
|
| 16 |
+
markdown-it-py==3.0.0
|
| 17 |
+
MarkupSafe==2.1.5
|
| 18 |
+
mdurl==0.1.2
|
| 19 |
+
orjson==3.10.3
|
| 20 |
+
pydantic==2.7.1
|
| 21 |
+
pydantic_core==2.18.2
|
| 22 |
+
Pygments==2.18.0
|
| 23 |
+
python-dotenv==1.0.1
|
| 24 |
+
python-multipart==0.0.9
|
| 25 |
+
PyYAML==6.0.1
|
| 26 |
+
rich==13.7.1
|
| 27 |
+
shellingham==1.5.4
|
| 28 |
+
sniffio==1.3.1
|
| 29 |
+
starlette==0.37.2
|
| 30 |
+
typer==0.12.3
|
| 31 |
+
typing_extensions==4.11.0
|
| 32 |
+
ujson==5.10.0
|
| 33 |
+
uvicorn==0.29.0
|
| 34 |
+
uvloop==0.19.0
|
| 35 |
+
watchfiles==0.21.0
|
| 36 |
+
websockets==12.0
|