Update
Browse files- Dockerfile +7 -0
- app.py +13 -4
- requirements.txt +1 -1
Dockerfile
CHANGED
|
@@ -43,6 +43,13 @@ RUN pyenv install ${PYTHON_VERSION} && \
|
|
| 43 |
COPY --chown=1000 ./requirements.txt /tmp/requirements.txt
|
| 44 |
RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt
|
| 45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
COPY --chown=1000 . ${HOME}/app
|
| 47 |
ENV PYTHONPATH=${HOME}/app \
|
| 48 |
PYTHONUNBUFFERED=1 \
|
|
|
|
| 43 |
COPY --chown=1000 ./requirements.txt /tmp/requirements.txt
|
| 44 |
RUN pip install --no-cache-dir --upgrade -r /tmp/requirements.txt
|
| 45 |
|
| 46 |
+
RUN git clone https://github.com/modelscope/modelscope && \
|
| 47 |
+
cd modelscope && \
|
| 48 |
+
pip install -r requirements.txt && \
|
| 49 |
+
pip install . && \
|
| 50 |
+
cd .. && \
|
| 51 |
+
rm -rf modelscope
|
| 52 |
+
|
| 53 |
COPY --chown=1000 . ${HOME}/app
|
| 54 |
ENV PYTHONPATH=${HOME}/app \
|
| 55 |
PYTHONUNBUFFERED=1 \
|
app.py
CHANGED
|
@@ -11,6 +11,8 @@ from modelscope.outputs import OutputKeys
|
|
| 11 |
from modelscope.pipelines import pipeline
|
| 12 |
|
| 13 |
DESCRIPTION = "# ModelScope-Image2Video"
|
|
|
|
|
|
|
| 14 |
|
| 15 |
if torch.cuda.is_available():
|
| 16 |
model_cache_dir = os.getenv("MODEL_CACHE_DIR", "./models")
|
|
@@ -29,9 +31,16 @@ def image_to_video(image_path: str) -> str:
|
|
| 29 |
|
| 30 |
with gr.Blocks(css="style.css") as demo:
|
| 31 |
gr.Markdown(DESCRIPTION)
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
run_button.click(
|
| 36 |
fn=image_to_video,
|
| 37 |
inputs=input_image,
|
|
@@ -40,4 +49,4 @@ with gr.Blocks(css="style.css") as demo:
|
|
| 40 |
)
|
| 41 |
|
| 42 |
if __name__ == "__main__":
|
| 43 |
-
demo.queue(max_size=
|
|
|
|
| 11 |
from modelscope.pipelines import pipeline
|
| 12 |
|
| 13 |
DESCRIPTION = "# ModelScope-Image2Video"
|
| 14 |
+
if not torch.cuda.is_available():
|
| 15 |
+
DESCRIPTION += "\n<p>Running on CPU 🥶 This demo does not work on CPU.</p>"
|
| 16 |
|
| 17 |
if torch.cuda.is_available():
|
| 18 |
model_cache_dir = os.getenv("MODEL_CACHE_DIR", "./models")
|
|
|
|
| 31 |
|
| 32 |
with gr.Blocks(css="style.css") as demo:
|
| 33 |
gr.Markdown(DESCRIPTION)
|
| 34 |
+
gr.DuplicateButton(
|
| 35 |
+
value="Duplicate Space for private use",
|
| 36 |
+
elem_id="duplicate-button",
|
| 37 |
+
visible=os.getenv("SHOW_DUPLICATE_BUTTON") == "1",
|
| 38 |
+
)
|
| 39 |
+
with gr.Group():
|
| 40 |
+
input_image = gr.Image(label="Input image", type="filepath")
|
| 41 |
+
run_button = gr.Button()
|
| 42 |
+
output_video = gr.Video(label="Output video")
|
| 43 |
+
|
| 44 |
run_button.click(
|
| 45 |
fn=image_to_video,
|
| 46 |
inputs=input_image,
|
|
|
|
| 49 |
)
|
| 50 |
|
| 51 |
if __name__ == "__main__":
|
| 52 |
+
demo.queue(max_size=10).launch()
|
requirements.txt
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
easydict==1.10
|
| 2 |
einops==0.6.1
|
| 3 |
fairscale==0.4.13
|
| 4 |
-
gradio==3.41.
|
| 5 |
huggingface_hub==0.16.4
|
| 6 |
imageio==2.31.1
|
| 7 |
modelscope==1.8.4
|
|
|
|
| 1 |
easydict==1.10
|
| 2 |
einops==0.6.1
|
| 3 |
fairscale==0.4.13
|
| 4 |
+
gradio==3.41.2
|
| 5 |
huggingface_hub==0.16.4
|
| 6 |
imageio==2.31.1
|
| 7 |
modelscope==1.8.4
|