Spaces:
Runtime error
Runtime error
Download app.py from 123LETSPLAY/hello: direct link, hf CLI and curl.
- Browser
- Download file 896 Bytes
-
https://huggingface.co/spaces/123LETSPLAY/hello/resolve/main/app.py
- Command line
-
hf download hf://spaces/123LETSPLAY/hello/app.py
-
curl -L -o app.py https://huggingface.co/spaces/123LETSPLAY/hello/resolve/main/app.py
896 Bytes
| import torch | |
| from diffusers import DiffusionPipeline | |
| import gradio as gr | |
| # Load the diffusion pipeline for CogVideoX model | |
| pipe = DiffusionPipeline.from_pretrained("THUDM/CogVideoX-5b-I2V", torch_dtype=torch.float16) | |
| def generate_image(prompt): | |
| image = pipe(prompt).images[0] | |
| return image | |
| # Set up Gradio interface | |
| with gr.Blocks() as demo: | |
| gr.Markdown("# Image Generation using CogVideoX Diffusers") | |
| # Input prompt | |
| prompt_input = gr.Textbox(label="Prompt", value="Astronaut in a jungle, cold color palette, muted colors, detailed, 8k") | |
| # Output image | |
| output_image = gr.Image(label="Generated Image") | |
| # Button to trigger image generation | |
| generate_button = gr.Button("Generate Image") | |
| # Bind button to function | |
| generate_button.click(fn=generate_image, inputs=prompt_input, outputs=output_image) | |
| # Launch Gradio app | |
| demo.launch() | |