Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import torch | |
| import os | |
| from dalle_mini import DalleBart | |
| from transformers import pipeline | |
| from huggingface_hub import InferenceClient | |
| from huggingface_hub import login | |
| login(token=os.getenv('HF_TOKEN')) | |
| pipe = DalleBart.from_pretrained("dalle-mini/dalle-mini", dtype="auto") | |
| def image_gen(prompt): | |
| image = pipe(prompt).images[0] | |
| iface = gr.Interface( | |
| fn=image_gen, | |
| inputs=gr.Textbox(lines=2,placeholder="Enter your prompt here..."), | |
| outputs=gr.Image(type="pil"), | |
| title="Text-to-Image Generator with VLM", | |
| description="Generate images from text prompts using a Vision-Language Model." | |
| ) |