text-image / app.py
vaheeD's picture
Update app.py
a50209b verified
raw
history blame contribute delete
680 Bytes
import gradio as gr
from transformers import pipeline
# Load a pre-trained image generation model
model = pipeline("text-to-image", model="stabilityai/stable-diffusion-2")
def generate_image(image, prompt):
# Here, you can implement your logic to modify the image based on the text prompt
# For simplicity, we are just generating an image from text
generated_image = model(prompt)
return generated_image[0]['image']
# Create a Gradio interface
iface = gr.Interface(
fn=generate_image,
inputs=[gr.inputs.Image(type="pil"), gr.inputs.Textbox(label="Enter your prompt")],
outputs="image",
title="Image Generation with Text Input"
)
iface.launch()