From fbb9a73ab400508cbd52b2d01eea41b5d337dd40 Mon Sep 17 00:00:00 2001 From: SolitaryThinker Date: Thu, 31 Jul 2025 08:34:39 +0000 Subject: [PATCH] checkpotint --- examples/inference/gradio/gradio_frontend.py | 12 ++++++------ examples/inference/gradio/ray_serve_backend.py | 4 +++- examples/inference/gradio/start_ray_serve_app.py | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/inference/gradio/gradio_frontend.py b/examples/inference/gradio/gradio_frontend.py index fcbc1da06..7578e57fa 100644 --- a/examples/inference/gradio/gradio_frontend.py +++ b/examples/inference/gradio/gradio_frontend.py @@ -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}", "" diff --git a/examples/inference/gradio/ray_serve_backend.py b/examples/inference/gradio/ray_serve_backend.py index c7c237756..6bbe72eb5 100644 --- a/examples/inference/gradio/ray_serve_backend.py +++ b/examples/inference/gradio/ray_serve_backend.py @@ -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 diff --git a/examples/inference/gradio/start_ray_serve_app.py b/examples/inference/gradio/start_ray_serve_app.py index d140f0495..1b2165b8c 100644 --- a/examples/inference/gradio/start_ray_serve_app.py +++ b/examples/inference/gradio/start_ray_serve_app.py @@ -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):