File size: 568 Bytes
2a644fe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | import gradio as gr
from transformers import pipeline
# Text-to-image pipeline initialize karna
pipe = pipeline("text-to-image-generation", model="dalle-mini/dalle-mini")
def generate_image(text):
# Text se image generate karna
result = pipe(text)
return result[0]["generated_image"]
# Gradio Interface banana
iface = gr.Interface(
fn=generate_image,
inputs="text",
outputs="image",
title="Text-to-Image Generator",
description="Enter a description, and this AI will generate an image based on it."
)
# Launch the app
iface.launch() |