Spaces:
Sleeping
Sleeping
Commit
·
15573e8
1
Parent(s):
ab2ae08
build: change startup process
Browse files- Dockerfile +3 -1
- app.py → main.py +6 -2
Dockerfile
CHANGED
@@ -11,4 +11,6 @@ WORKDIR /
|
|
11 |
RUN pip install --no-cache-dir --upgrade -r /requirements.txt
|
12 |
|
13 |
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
14 |
-
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
|
|
|
|
|
11 |
RUN pip install --no-cache-dir --upgrade -r /requirements.txt
|
12 |
|
13 |
# Start the FastAPI app on port 7860, the default port expected by Spaces
|
14 |
+
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
|
15 |
+
|
16 |
+
EXPOSE 7860
|
app.py → main.py
RENAMED
@@ -1,4 +1,5 @@
|
|
1 |
import os
|
|
|
2 |
from typing import Annotated
|
3 |
from fastapi import FastAPI, Header
|
4 |
from apis.s3 import S3
|
@@ -52,7 +53,7 @@ def healthcheck():
|
|
52 |
return {"message": "ok"}
|
53 |
|
54 |
@app.post("/image")
|
55 |
-
def upload(
|
56 |
o: ImageObject,
|
57 |
headers: Annotated[CommonHeaders, Header()]
|
58 |
):
|
@@ -73,4 +74,7 @@ def upload(
|
|
73 |
# return (username == u and password == p)
|
74 |
|
75 |
# # Launch the Gradio app
|
76 |
-
# demo.launch(auth=auth if not IS_DEV else None)
|
|
|
|
|
|
|
|
1 |
import os
|
2 |
+
import uvicorn
|
3 |
from typing import Annotated
|
4 |
from fastapi import FastAPI, Header
|
5 |
from apis.s3 import S3
|
|
|
53 |
return {"message": "ok"}
|
54 |
|
55 |
@app.post("/image")
|
56 |
+
async def upload(
|
57 |
o: ImageObject,
|
58 |
headers: Annotated[CommonHeaders, Header()]
|
59 |
):
|
|
|
74 |
# return (username == u and password == p)
|
75 |
|
76 |
# # Launch the Gradio app
|
77 |
+
# demo.launch(auth=auth if not IS_DEV else None)
|
78 |
+
|
79 |
+
if __name__=='__main__':
|
80 |
+
uvicorn.run('main:app', reload=True)
|