Spaces:
Running
Running
Update app.py
Browse files2 unmodified lines3456784 unmodified lines131415161718192029 unmodified lines5051525354555657585960612 unmodified linesimport numpy as npfrom diffusers import AutoPipelineForImage2Imagefrom diffusers.utils import load_image# 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)result = pipe(prompt=prompt, image=image, strength=0.75).images[0]return np.array(result)29 unmodified linesfn=video_to_anime,inputs=[gr.Video(label="Input Video"),gr.Textbox(label="Style Prompt", value="Arcane style") # Changed 'default' to 'value'],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()2 unmodified lines34567894 unmodified lines14151617181920212229 unmodified lines5253545556575859606162632 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) # Convert BGR to RGBpil_image = Image.fromarray(frame_rgb) # Convert NumPy array to PIL imageimage = load_image(pil_image) # Pass PIL image to load_imageresult = pipe(prompt=prompt, image=image, strength=0.75).images[0]return np.array(result)29 unmodified linesfn=video_to_anime,inputs=[gr.Video(label="Input Video"),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 interface with a public linkiface.launch(share=True) # Added share=True as per the suggestion
app.py+7-5