Spaces:
Runtime error
Runtime error
Commit
Β·
d8b200a
1
Parent(s):
e2b58e7
Add docker container for more robust app
Browse filesSwitches to a known good base container image that is compatible
with the dependencies used by the app.
- Dockerfile +27 -0
- README.md +1 -3
- app.py +1 -1
- app_header.md +2 -1
Dockerfile
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.9
|
| 2 |
+
|
| 3 |
+
# Add settings taken from huggingface default container.
|
| 4 |
+
WORKDIR /home/user/app
|
| 5 |
+
RUN useradd -m -u 1000 user
|
| 6 |
+
RUN apt-get update && apt-get install -y \
|
| 7 |
+
git git-lfs ffmpeg libsm6 libxext6 \
|
| 8 |
+
cmake libgl1-mesa-glx \
|
| 9 |
+
&& rm -rf /var/lib/apt/lists/* \
|
| 10 |
+
&& git lfs install
|
| 11 |
+
|
| 12 |
+
# Use older setuptools to avoid 2to3 error with dependencies.
|
| 13 |
+
RUN pip install 'setuptools<58'
|
| 14 |
+
|
| 15 |
+
# Install drexel_metadata dependencies
|
| 16 |
+
COPY requirements.txt requirements.txt
|
| 17 |
+
RUN pip install -r requirements.txt
|
| 18 |
+
|
| 19 |
+
# Install gradio after main dependencies to prevent
|
| 20 |
+
# `cannot import name 'deprecated' from 'typing_extensions'` error.
|
| 21 |
+
RUN pip install gradio
|
| 22 |
+
|
| 23 |
+
# Cache matplotlib fonts to improve startup time.
|
| 24 |
+
RUN python -c "import matplotlib.pyplot"
|
| 25 |
+
|
| 26 |
+
COPY . /home/user/app
|
| 27 |
+
CMD python app.py
|
README.md
CHANGED
|
@@ -3,11 +3,9 @@ title: Drexel Metadata App
|
|
| 3 |
emoji: π’
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: red
|
| 6 |
-
sdk:
|
| 7 |
-
sdk_version: 3.6
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
python_version: 3.9.18
|
| 11 |
license: mit
|
| 12 |
---
|
| 13 |
|
|
|
|
| 3 |
emoji: π’
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: red
|
| 6 |
+
sdk: docker
|
|
|
|
| 7 |
app_file: app.py
|
| 8 |
pinned: false
|
|
|
|
| 9 |
license: mit
|
| 10 |
---
|
| 11 |
|
app.py
CHANGED
|
@@ -73,5 +73,5 @@ dm_app = gr.Interface(
|
|
| 73 |
allow_flagging="never", # Do not save user's results or prompt for users to save the results
|
| 74 |
examples=EXAMPLES,
|
| 75 |
)
|
| 76 |
-
dm_app.launch()
|
| 77 |
|
|
|
|
| 73 |
allow_flagging="never", # Do not save user's results or prompt for users to save the results
|
| 74 |
examples=EXAMPLES,
|
| 75 |
)
|
| 76 |
+
dm_app.launch(server_name="0.0.0.0")
|
| 77 |
|
app_header.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
| 1 |
# Drexel Metadata
|
| 2 |
-
Generate
|
| 3 |
The model will create a visualization based on the image, a mask of the fish outline, and JSON metadata.
|
|
|
|
|
|
| 1 |
# Drexel Metadata
|
| 2 |
+
Generate object detection metadata for a fish image using the [imageomics/Drexel-metadata-generator model](https://huggingface.co/imageomics/Drexel-metadata-generator).
|
| 3 |
The model will create a visualization based on the image, a mask of the fish outline, and JSON metadata.
|
| 4 |
+
The source code for the model is available at [hdr-bgnn/drexel_metadata model](https://github.com/hdr-bgnn/drexel_metadata).
|