Spaces:
Running
Running
Update app.py
Browse files2 unmodified lines34567894 unmodified lines141516161717181920212229 unmodified lines5253545355565758596061606162632 unmodified linesimport numpy as npfrom diffusers import AutoPipelineForImage2Imagefrom diffusers.utils import load_imagefrom PIL import Image # Add this import
# Load the anime-style diffusion modelpipe = AutoPipelineForImage2Image.from_pretrained(4 unmodified lines
# Function to process a single framedef process_frame(frame, prompt): frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) image = load_image(frame_rgb) frame_rgb = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) # Convert BGR to RGB pil_image = Image.fromarray(frame_rgb) # Convert NumPy array to PIL image image = load_image(pil_image) # Pass PIL image to load_image result = pipe(prompt=prompt, image=image, strength=0.75).images[0] return np.array(result)
29 unmodified lines fn=video_to_anime, inputs=[ gr.Video(label="Input Video"), gr.Textbox(label="Style Prompt", value="Arcane style") # Changed 'default' to 'value' gr.Textbox(label="Style Prompt", value="Arcane style") ], outputs=gr.Video(label="Output Video"), title="Video to Anime Converter", description="Upload a video and convert it to anime style!")
# Launch the interfaceiface.launch()# Launch the interface with a public linkiface.launch(share=True) # Added share=True as per the suggestionapp.py+7-5