Spaces:
Runtime error
Runtime error
jmanhype
commited on
Commit
·
8221cd6
1
Parent(s):
9bb0e80
Fix path handling and add more debugging
Browse files- Dockerfile +6 -2
- app.py +44 -6
Dockerfile
CHANGED
@@ -43,13 +43,17 @@ RUN pip install --no-cache-dir openmim && \
|
|
43 |
mim install "mmdet>=3.1.0" && \
|
44 |
mim install "mmpose>=1.1.0"
|
45 |
|
46 |
-
# Clone and set up MuseV
|
47 |
RUN git clone https://github.com/TMElyralab/MuseV.git && \
|
48 |
cd MuseV && \
|
49 |
git clone https://github.com/huggingface/diffusers.git && \
|
50 |
git clone https://github.com/patrickvonplaten/controlnet_aux.git && \
|
51 |
cd diffusers && pip install -e . && \
|
52 |
-
cd ../controlnet_aux && pip install -e .
|
|
|
|
|
|
|
|
|
53 |
|
54 |
# Set up Python path
|
55 |
ENV PYTHONPATH="${HOME}/app:${HOME}/app/MuseV:${HOME}/app/MuseV/MMCM:${HOME}/app/MuseV/diffusers/src:${HOME}/app/MuseV/controlnet_aux/src:${HOME}/app/MuseV/scripts/gradio"
|
|
|
43 |
mim install "mmdet>=3.1.0" && \
|
44 |
mim install "mmpose>=1.1.0"
|
45 |
|
46 |
+
# Clone and set up MuseV with exact case
|
47 |
RUN git clone https://github.com/TMElyralab/MuseV.git && \
|
48 |
cd MuseV && \
|
49 |
git clone https://github.com/huggingface/diffusers.git && \
|
50 |
git clone https://github.com/patrickvonplaten/controlnet_aux.git && \
|
51 |
cd diffusers && pip install -e . && \
|
52 |
+
cd ../controlnet_aux && pip install -e . && \
|
53 |
+
cd .. && \
|
54 |
+
# Create symbolic links for gradio scripts
|
55 |
+
ln -s scripts/gradio/gradio_video2video.py ../gradio_video2video.py && \
|
56 |
+
ln -s scripts/gradio/gradio_text2video.py ../gradio_text2video.py
|
57 |
|
58 |
# Set up Python path
|
59 |
ENV PYTHONPATH="${HOME}/app:${HOME}/app/MuseV:${HOME}/app/MuseV/MMCM:${HOME}/app/MuseV/diffusers/src:${HOME}/app/MuseV/controlnet_aux/src:${HOME}/app/MuseV/scripts/gradio"
|
app.py
CHANGED
@@ -11,26 +11,35 @@ import cuid
|
|
11 |
|
12 |
from huggingface_hub import snapshot_download
|
13 |
|
|
|
|
|
14 |
# Set up paths
|
15 |
ProjectDir = os.path.dirname(os.path.abspath(__file__))
|
16 |
CheckpointsDir = os.path.join(ProjectDir, "checkpoints")
|
17 |
-
MuseVDir = os.path.join(ProjectDir, "MuseV")
|
18 |
GradioScriptsDir = os.path.join(MuseVDir, "scripts", "gradio")
|
19 |
|
|
|
|
|
|
|
|
|
20 |
# Add the MuseV paths to sys.path
|
21 |
paths_to_add = [
|
|
|
22 |
GradioScriptsDir,
|
23 |
MuseVDir,
|
24 |
os.path.join(MuseVDir, "MMCM"),
|
25 |
os.path.join(MuseVDir, "diffusers", "src"),
|
26 |
-
os.path.join(MuseVDir, "controlnet_aux", "src")
|
27 |
-
os.path.dirname(os.path.abspath(__file__))
|
28 |
]
|
29 |
|
30 |
for path in paths_to_add:
|
31 |
-
if os.path.exists(path)
|
32 |
-
sys.path
|
33 |
-
|
|
|
|
|
|
|
34 |
|
35 |
def download_model():
|
36 |
if not os.path.exists(CheckpointsDir):
|
@@ -55,6 +64,24 @@ for path in sys.path:
|
|
55 |
print(f"Path: {path}")
|
56 |
|
57 |
print("Attempting to import gradio modules...")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
try:
|
59 |
from gradio_video2video import online_v2v_inference
|
60 |
print("Successfully imported video2video")
|
@@ -70,10 +97,21 @@ try:
|
|
70 |
print("Successfully imported text2video")
|
71 |
except Exception as e:
|
72 |
print(f"Error importing text2video: {str(e)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
ignore_video2video = False
|
75 |
max_image_edge = 1280
|
76 |
|
|
|
|
|
|
|
|
|
77 |
print("Setting up Gradio interface...")
|
78 |
demo = gr.Interface(
|
79 |
fn=online_t2v_inference,
|
|
|
11 |
|
12 |
from huggingface_hub import snapshot_download
|
13 |
|
14 |
+
print("Starting application...")
|
15 |
+
|
16 |
# Set up paths
|
17 |
ProjectDir = os.path.dirname(os.path.abspath(__file__))
|
18 |
CheckpointsDir = os.path.join(ProjectDir, "checkpoints")
|
19 |
+
MuseVDir = os.path.join(ProjectDir, "MuseV") # Note the capital V
|
20 |
GradioScriptsDir = os.path.join(MuseVDir, "scripts", "gradio")
|
21 |
|
22 |
+
print(f"Project directory: {ProjectDir}")
|
23 |
+
print(f"MuseV directory: {MuseVDir}")
|
24 |
+
print(f"Gradio scripts directory: {GradioScriptsDir}")
|
25 |
+
|
26 |
# Add the MuseV paths to sys.path
|
27 |
paths_to_add = [
|
28 |
+
ProjectDir, # Add current directory first
|
29 |
GradioScriptsDir,
|
30 |
MuseVDir,
|
31 |
os.path.join(MuseVDir, "MMCM"),
|
32 |
os.path.join(MuseVDir, "diffusers", "src"),
|
33 |
+
os.path.join(MuseVDir, "controlnet_aux", "src")
|
|
|
34 |
]
|
35 |
|
36 |
for path in paths_to_add:
|
37 |
+
if os.path.exists(path):
|
38 |
+
if path not in sys.path:
|
39 |
+
sys.path.insert(0, path)
|
40 |
+
print(f"Added {path} to PYTHONPATH")
|
41 |
+
else:
|
42 |
+
print(f"Warning: Path does not exist: {path}")
|
43 |
|
44 |
def download_model():
|
45 |
if not os.path.exists(CheckpointsDir):
|
|
|
64 |
print(f"Path: {path}")
|
65 |
|
66 |
print("Attempting to import gradio modules...")
|
67 |
+
|
68 |
+
# First check if the files exist
|
69 |
+
print("Checking for gradio module files...")
|
70 |
+
video2video_path = os.path.join(ProjectDir, "gradio_video2video.py")
|
71 |
+
text2video_path = os.path.join(ProjectDir, "gradio_text2video.py")
|
72 |
+
print(f"Looking for video2video at: {video2video_path}")
|
73 |
+
print(f"Looking for text2video at: {text2video_path}")
|
74 |
+
|
75 |
+
if os.path.exists(video2video_path):
|
76 |
+
print(f"Found video2video at {video2video_path}")
|
77 |
+
else:
|
78 |
+
print(f"Warning: video2video not found at {video2video_path}")
|
79 |
+
|
80 |
+
if os.path.exists(text2video_path):
|
81 |
+
print(f"Found text2video at {text2video_path}")
|
82 |
+
else:
|
83 |
+
print(f"Warning: text2video not found at {text2video_path}")
|
84 |
+
|
85 |
try:
|
86 |
from gradio_video2video import online_v2v_inference
|
87 |
print("Successfully imported video2video")
|
|
|
97 |
print("Successfully imported text2video")
|
98 |
except Exception as e:
|
99 |
print(f"Error importing text2video: {str(e)}")
|
100 |
+
print("Attempting to import directly from MuseV...")
|
101 |
+
try:
|
102 |
+
sys.path.insert(0, os.path.join(MuseVDir, "scripts", "gradio"))
|
103 |
+
from gradio_text2video import online_t2v_inference
|
104 |
+
print("Successfully imported text2video from MuseV directory")
|
105 |
+
except Exception as e2:
|
106 |
+
print(f"Error importing from MuseV directory: {str(e2)}")
|
107 |
|
108 |
ignore_video2video = False
|
109 |
max_image_edge = 1280
|
110 |
|
111 |
+
if 'online_t2v_inference' not in locals():
|
112 |
+
print("ERROR: Failed to import online_t2v_inference. Cannot continue.")
|
113 |
+
sys.exit(1)
|
114 |
+
|
115 |
print("Setting up Gradio interface...")
|
116 |
demo = gr.Interface(
|
117 |
fn=online_t2v_inference,
|