Update app.py
Browse files
app.py
CHANGED
|
@@ -159,16 +159,24 @@ def generate_video(
|
|
| 159 |
enhance_prompt=enhance_prompt,
|
| 160 |
input_image=image_input,
|
| 161 |
seed=current_seed,
|
|
|
|
| 162 |
api_name="/encode_prompt"
|
| 163 |
)
|
| 164 |
embedding_path = result[0] # Path to .pt file
|
| 165 |
print(f"Embeddings received from: {embedding_path}")
|
| 166 |
-
|
| 167 |
# Load embeddings
|
| 168 |
embeddings = torch.load(embedding_path)
|
| 169 |
-
|
| 170 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 171 |
print("✓ Embeddings loaded successfully")
|
|
|
|
|
|
|
| 172 |
except Exception as e:
|
| 173 |
raise RuntimeError(
|
| 174 |
f"Failed to get embeddings from text encoder space: {e}\n"
|
|
@@ -189,8 +197,10 @@ def generate_video(
|
|
| 189 |
cfg_guidance_scale=cfg_guidance_scale,
|
| 190 |
images=images,
|
| 191 |
tiling_config=TilingConfig.default(),
|
| 192 |
-
|
| 193 |
-
|
|
|
|
|
|
|
| 194 |
)
|
| 195 |
|
| 196 |
return str(output_path), current_seed
|
|
|
|
| 159 |
enhance_prompt=enhance_prompt,
|
| 160 |
input_image=image_input,
|
| 161 |
seed=current_seed,
|
| 162 |
+
negative_prompt=negative_prompt,
|
| 163 |
api_name="/encode_prompt"
|
| 164 |
)
|
| 165 |
embedding_path = result[0] # Path to .pt file
|
| 166 |
print(f"Embeddings received from: {embedding_path}")
|
| 167 |
+
|
| 168 |
# Load embeddings
|
| 169 |
embeddings = torch.load(embedding_path)
|
| 170 |
+
video_context_positive = embeddings['video_context']
|
| 171 |
+
audio_context_positive = embeddings['audio_context']
|
| 172 |
+
|
| 173 |
+
# Load negative contexts if available
|
| 174 |
+
video_context_negative = embeddings.get('video_context_negative', None)
|
| 175 |
+
audio_context_negative = embeddings.get('audio_context_negative', None)
|
| 176 |
+
|
| 177 |
print("✓ Embeddings loaded successfully")
|
| 178 |
+
if video_context_negative is not None:
|
| 179 |
+
print(" ✓ Negative prompt embeddings also loaded")
|
| 180 |
except Exception as e:
|
| 181 |
raise RuntimeError(
|
| 182 |
f"Failed to get embeddings from text encoder space: {e}\n"
|
|
|
|
| 197 |
cfg_guidance_scale=cfg_guidance_scale,
|
| 198 |
images=images,
|
| 199 |
tiling_config=TilingConfig.default(),
|
| 200 |
+
video_context_positive=video_context_positive,
|
| 201 |
+
audio_context_positive=audio_context_positive,
|
| 202 |
+
video_context_negative=video_context_negative,
|
| 203 |
+
audio_context_negative=audio_context_negative,
|
| 204 |
)
|
| 205 |
|
| 206 |
return str(output_path), current_seed
|