Spaces:
Runtime error
Runtime error
Commit ·
e71c987
1
Parent(s): fc78a70
feat(main): change provider to gradio instead fastapi
Browse files- Dockerfile +5 -2
- src/app.py +1 -6
Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 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.
|
| 5 |
|
| 6 |
RUN useradd -m -u 1000 user
|
| 7 |
USER user
|
|
@@ -12,5 +12,8 @@ WORKDIR /app
|
|
| 12 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
|
|
|
|
|
|
|
|
|
|
| 15 |
COPY --chown=user src /app
|
| 16 |
-
CMD ["
|
|
|
|
| 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.10-slim
|
| 5 |
|
| 6 |
RUN useradd -m -u 1000 user
|
| 7 |
USER user
|
|
|
|
| 12 |
COPY --chown=user ./requirements.txt requirements.txt
|
| 13 |
RUN pip install --no-cache-dir --upgrade -r requirements.txt
|
| 14 |
|
| 15 |
+
EXPOSE 7860
|
| 16 |
+
ENV GRADIO_SERVER_NAME="0.0.0.0"
|
| 17 |
+
|
| 18 |
COPY --chown=user src /app
|
| 19 |
+
CMD ["python", "app.py"]
|
src/app.py
CHANGED
|
@@ -1,11 +1,6 @@
|
|
| 1 |
-
from fastapi import FastAPI
|
| 2 |
import gradio as gr
|
| 3 |
|
| 4 |
-
app = FastAPI()
|
| 5 |
-
|
| 6 |
def greet(name):
|
| 7 |
return f"Hello {name}!"
|
| 8 |
|
| 9 |
-
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 10 |
-
|
| 11 |
-
app.mount("/", iface)
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
|
|
|
|
|
|
| 3 |
def greet(name):
|
| 4 |
return f"Hello {name}!"
|
| 5 |
|
| 6 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text").launch()
|
|
|
|
|
|