checkpotint

This commit is contained in:
SolitaryThinker
2025-07-31 08:34:39 +00:00
parent daea023383
commit fbb9a73ab4
3 changed files with 10 additions and 7 deletions
+6 -6
View File
@@ -172,7 +172,7 @@ def create_gradio_interface(backend_url: str, default_params: SamplingParam):
"width": width,
"num_inference_steps": num_inference_steps,
"randomize_seed": randomize_seed,
"return_frames": True, # Always request frames
"return_frames": False, # Always request frames
"image_path": image_path,
"model_type": "i2v" if image_path else "t2v" # Use I2V model if image is provided, T2V otherwise
}
@@ -202,8 +202,8 @@ def create_gradio_interface(backend_url: str, default_params: SamplingParam):
try:
# Get the output directory from the video path
output_dir = os.path.dirname(output_path) if output_path else "outputs"
frames_status, video_path = decode_and_save_video_from_frames(frames_b64, output_dir, prompt)
print(f"Frames: {frames_status}")
# frames_status, video_path = decode_and_save_video_from_frames(frames_b64, output_dir, prompt)
# print(f"Frames: {frames_status}")
except Exception as e:
frames_status = f"Failed to save frames video: {str(e)}"
print(f"Frame extraction error: {e}")
@@ -211,10 +211,10 @@ def create_gradio_interface(backend_url: str, default_params: SamplingParam):
frames_status = "No frames returned from backend"
# Check if the video file exists
if os.path.exists(video_path):
return video_path, used_seed, frames_status
if os.path.exists(output_path):
return output_path, used_seed, frames_status
else:
return None, f"Video generated but file not found at {video_path} {frames_status}", frames_status
return None, f"Video generated but file not found at {output_path} {frames_status}", frames_status
else:
error_msg = response.get("error_message", "Unknown error occurred")
return None, f"Generation failed: {error_msg}", ""
@@ -208,6 +208,8 @@ class FastVideoAPI:
# Create a clean filename from the prompt
safe_prompt = video_request.prompt[:100].replace(' ', '_').replace('/', '_').replace('\\', '_')
params.output_path = self.output_path + "/" + safe_prompt + ".mp4"
# Store desired video name inside the SamplingParam to avoid unknown kwarg errors
setattr(params, "output_video_name", safe_prompt)
@@ -241,7 +243,7 @@ class FastVideoAPI:
encoded_frames = None
response = VideoGenerationResponse(
output_path="",
output_path=self.output_path,
frames=encoded_frames,
seed=params.seed,
success=True
@@ -187,6 +187,7 @@ def main():
print(f"📺 Frontend will be available at: http://{args.frontend_host}:{args.frontend_port}")
print(f"🔧 Backend API will be available at: {backend_url}")
print("\nPress Ctrl+C to stop both services...")
# return
# Signal handler for graceful shutdown
def signal_handler(signum, frame):