debug: tuple vs image output

#1
by ferrymangmi - opened
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -1,3 +1,22 @@
1
  import gradio as gr
 
2
 
3
- gr.load("models/Yaquv/rick").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from diffusers import DiffusionPipeline
3
 
4
+ # Load the model
5
+ pipe = DiffusionPipeline.from_pretrained("Yaquv/rick")
6
+
7
+ # Define a prediction function to handle the output
8
+ def predict(text):
9
+ output = pipe(text) # Run the model with the text input
10
+ # Assuming the output is a tuple and the image is the first element
11
+ image = output[0]
12
+ return image
13
+
14
+ # Create a Gradio interface
15
+ iface = gr.Interface(
16
+ fn=predict, # The prediction function
17
+ inputs="text", # Text input for the prompt
18
+ outputs="image" # Expecting an image output
19
+ )
20
+
21
+ # Launch the app
22
+ iface.launch()