Spaces:
Runtime error
Runtime error
Update app.py
Browse files39 unmodified lines404142434445412 unmodified lines45845946046146246336 unmodified lines50050150250350450539 unmodified linesfrom demo_utils.vae_block3 import VAEDecoderWrapperfrom utils.wan_wrapper import WanDiffusionWrapper, WanTextEncoder# --- Argument Parsing ---parser = argparse.ArgumentParser(description="Gradio Demo for Self-Forcing with Frame Streaming")parser.add_argument('--port', type=int, default=7860, help="Port to run the Gradio app on.")412 unmodified linesplaceholder="A stylish woman walks down a Tokyo street...",lines=4,)gr.Examples(examples=["A close-up shot of a ceramic teacup slowly pouring water into a glass mug. The water flows smoothly from the spout of the teacup into the mug, creating gentle ripples as it fills up. Both cups have detailed textures, with the teacup having a matte finish and the glass mug showcasing clear transparency. The background is a blurred kitchen countertop, adding context without distracting from the central action. The pouring motion is fluid and natural, emphasizing the interaction between the two cups.",36 unmodified linesinputs=[prompt, seed, fps],outputs=[frame_display, final_video, status_html])# --- Launch App ---if __name__ == "__main__":39 unmodified lines404142434445464748495051525354555657585960616263646566412 unmodified lines47948048148248348448536 unmodified lines52252352452552652752852953053153239 unmodified linesfrom demo_utils.vae_block3 import VAEDecoderWrapperfrom utils.wan_wrapper import WanDiffusionWrapper, WanTextEncoderfrom transformers import pipeline, AutoTokenizer, AutoModelForSeq2SeqLMdevice = "cuda" if torch.cuda.is_available() else "cpu"model_checkpoint = "gokaygokay/Flux-Prompt-Enhance"tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)enhancer = pipeline('text2text-generation',model=model,tokenizer=tokenizer,repetition_penalty= 1.2)enhancer.to(device)max_target_length = 256@spaces.GPUdef enhance_prompt(prompt):prefix = "enhance prompt: "short_prompt = promptanswer = enhancer(prefix + short_prompt, max_length=max_target_length)final_answer = answer[0]['generated_text']return final_answer# --- Argument Parsing ---parser = argparse.ArgumentParser(description="Gradio Demo for Self-Forcing with Frame Streaming")parser.add_argument('--port', type=int, default=7860, help="Port to run the Gradio app on.")412 unmodified linesplaceholder="A stylish woman walks down a Tokyo street...",lines=4,)enhance_button = gr.Button("Enhance prompt")gr.Examples(examples=["A close-up shot of a ceramic teacup slowly pouring water into a glass mug. The water flows smoothly from the spout of the teacup into the mug, creating gentle ripples as it fills up. Both cups have detailed textures, with the teacup having a matte finish and the glass mug showcasing clear transparency. The background is a blurred kitchen countertop, adding context without distracting from the central action. The pouring motion is fluid and natural, emphasizing the interaction between the two cups.",36 unmodified linesinputs=[prompt, seed, fps],outputs=[frame_display, final_video, status_html])enhance_button.click(fn=enhance_prompt,inputs=[prompt],outputs=[prompt])# --- Launch App ---if __name__ == "__main__":
app.py+27