Kvikontent commited on
Commit
2562685
·
verified ·
1 Parent(s): fc45018

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from diffusers import DiffusionPipeline
3
+
4
+ # Load the pretrained model
5
+ pipeline = DiffusionPipeline.from_pretrained("stabilityai/sdxl-turbo")
6
+
7
+ # Define a function to use the model for prediction
8
+ def predict(text_input):
9
+ # Use the pipeline to make predictions
10
+ output = pipeline(text_input)
11
+ return output
12
+
13
+ # Create a Gradio interface
14
+ iface = gr.Interface(
15
+ fn=predict,
16
+ inputs=gr.Textbox(lines=5, label="Input Text"),
17
+ outputs="text",
18
+ title="Diffusion Pipeline App",
19
+ description="Enter the text to get the model's predictions on the input."
20
+ )
21
+
22
+ # Launch the Gradio interface
23
+ iface.launch()