jmanhype commited on
Commit
231fef0
·
1 Parent(s): c01db76

Fix file copying and directory handling

Browse files
Files changed (2) hide show
  1. Dockerfile +4 -4
  2. app.py +22 -21
Dockerfile CHANGED
@@ -43,7 +43,10 @@ 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 first
 
 
 
47
  RUN git clone https://github.com/TMElyralab/MuseV.git && \
48
  cd MuseV && \
49
  git clone https://github.com/huggingface/diffusers.git && \
@@ -56,9 +59,6 @@ RUN git clone https://github.com/TMElyralab/MuseV.git && \
56
  cp scripts/gradio/gradio_text2video.py ../gradio_text2video.py && \
57
  chmod +x ../gradio_*.py
58
 
59
- # Now copy application code
60
- COPY --chown=user:user . .
61
-
62
  # Set up Python path
63
  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"
64
 
 
43
  mim install "mmdet>=3.1.0" && \
44
  mim install "mmpose>=1.1.0"
45
 
46
+ # Copy application code first (excluding MuseV directory)
47
+ COPY --chown=user:user README.md requirements.txt app.py ./
48
+
49
+ # Clone and set up MuseV
50
  RUN git clone https://github.com/TMElyralab/MuseV.git && \
51
  cd MuseV && \
52
  git clone https://github.com/huggingface/diffusers.git && \
 
59
  cp scripts/gradio/gradio_text2video.py ../gradio_text2video.py && \
60
  chmod +x ../gradio_*.py
61
 
 
 
 
62
  # Set up Python path
63
  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"
64
 
app.py CHANGED
@@ -66,6 +66,8 @@ if musev_candidates:
66
  print("Successfully renamed musev to MuseV")
67
  except Exception as e:
68
  print(f"Warning: Could not rename directory: {str(e)}")
 
 
69
  else:
70
  print("Warning: Could not find MuseV directory")
71
  sys.exit(1)
@@ -117,32 +119,31 @@ for path in sys.path:
117
 
118
  print("Attempting to import gradio modules...")
119
 
120
- # Search for gradio modules in multiple locations
121
- video2video_path = find_file("gradio_video2video.py", ProjectDir)
122
- text2video_path = find_file("gradio_text2video.py", ProjectDir)
123
 
124
  print(f"Looking for modules at:")
125
  print(f"video2video: {video2video_path}")
126
  print(f"text2video: {text2video_path}")
127
 
128
- if not video2video_path or not text2video_path:
129
- print("Searching in MuseV directory...")
130
- if os.path.exists(GradioScriptsDir):
131
- video2video_path = find_file("gradio_video2video.py", GradioScriptsDir)
132
- text2video_path = find_file("gradio_text2video.py", GradioScriptsDir)
133
- print(f"Found in MuseV: video2video={video2video_path}, text2video={text2video_path}")
134
-
135
- # If found in MuseV, copy to app directory
136
- if video2video_path and text2video_path:
137
- shutil.copy2(video2video_path, ProjectDir)
138
- shutil.copy2(text2video_path, ProjectDir)
139
- video2video_path = os.path.join(ProjectDir, "gradio_video2video.py")
140
- text2video_path = os.path.join(ProjectDir, "gradio_text2video.py")
141
- print("Copied gradio scripts to app directory")
142
-
143
- if not video2video_path or not text2video_path:
144
- print("Error: Could not find gradio modules")
145
- sys.exit(1)
146
 
147
  try:
148
  print("Attempting to import modules...")
 
66
  print("Successfully renamed musev to MuseV")
67
  except Exception as e:
68
  print(f"Warning: Could not rename directory: {str(e)}")
69
+ # If we can't rename, use the existing directory
70
+ MuseVDir = os.path.join(ProjectDir, "musev")
71
  else:
72
  print("Warning: Could not find MuseV directory")
73
  sys.exit(1)
 
119
 
120
  print("Attempting to import gradio modules...")
121
 
122
+ # First try to find modules in current directory
123
+ video2video_path = os.path.join(ProjectDir, "gradio_video2video.py")
124
+ text2video_path = os.path.join(ProjectDir, "gradio_text2video.py")
125
 
126
  print(f"Looking for modules at:")
127
  print(f"video2video: {video2video_path}")
128
  print(f"text2video: {text2video_path}")
129
 
130
+ # If not found in current directory, look in MuseV directory
131
+ if not os.path.exists(video2video_path) or not os.path.exists(text2video_path):
132
+ print("Modules not found in current directory, checking MuseV directory...")
133
+ musev_video2video = os.path.join(GradioScriptsDir, "gradio_video2video.py")
134
+ musev_text2video = os.path.join(GradioScriptsDir, "gradio_text2video.py")
135
+
136
+ if os.path.exists(musev_video2video) and os.path.exists(musev_text2video):
137
+ print("Found modules in MuseV directory, copying to current directory...")
138
+ shutil.copy2(musev_video2video, video2video_path)
139
+ shutil.copy2(musev_text2video, text2video_path)
140
+ print("Successfully copied modules")
141
+ else:
142
+ print("Error: Could not find modules in MuseV directory")
143
+ print(f"MuseV scripts directory contents:")
144
+ if os.path.exists(GradioScriptsDir):
145
+ print(os.listdir(GradioScriptsDir))
146
+ sys.exit(1)
 
147
 
148
  try:
149
  print("Attempting to import modules...")