Spaces:
Runtime error
Runtime error
Kvikontent
commited on
Commit
•
0a66490
1
Parent(s):
bc110b1
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from diffusers import DiffusionPipeline
|
3 |
+
|
4 |
+
# Load the DiffusionPipeline and LORA weights
|
5 |
+
pipeline = DiffusionPipeline.from_pretrained("stablediffusionapi/juggernaut-xl-v5")
|
6 |
+
pipeline.load_lora_weights("Kvikontent/kviimager2.0")
|
7 |
+
|
8 |
+
# Define the function to handle user input and generate the image
|
9 |
+
def generate_image(prompt):
|
10 |
+
image = pipeline(prompt)
|
11 |
+
return image
|
12 |
+
|
13 |
+
# Create a Gradio interface
|
14 |
+
iface = gr.Interface(
|
15 |
+
fn=generate_image,
|
16 |
+
inputs="text",
|
17 |
+
outputs="image",
|
18 |
+
title="KVIImager 2.0 Demo",
|
19 |
+
description="Enter a prompt to generate an image"
|
20 |
+
)
|
21 |
+
|
22 |
+
# Add examples for the user input
|
23 |
+
examples = [
|
24 |
+
"Sunset over the ocean",
|
25 |
+
"Starry night sky"
|
26 |
+
]
|
27 |
+
|
28 |
+
iface.set_config(
|
29 |
+
examples=examples
|
30 |
+
)
|
31 |
+
|
32 |
+
# Launch the Gradio interface
|
33 |
+
iface.launch()
|