File size: 678 Bytes
2562685
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2daab00
2562685
2daab00
2562685
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import gradio as gr
from diffusers import DiffusionPipeline

# Load the pretrained model
pipeline = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo")

# Define a function to use the model for prediction
def predict(text_input):
    # Use the pipeline to make predictions
    output = pipeline(text_input)
    return output

# Create a Gradio interface
iface = gr.Interface(
    fn=predict,
    inputs=gr.Textbox(lines=5, label="Input Text"),
    outputs=gr.Image(type="numpy", label="Output Image"),
    title="Diffusion Pipeline App",
    description="Enter the text to get the model's predictions as an output image."
)

# Launch the Gradio interface
iface.launch()