Spaces:
Runtime error
Runtime error
Add harcoded keywords
#1
by
mblanco
- opened
app.py
CHANGED
@@ -1,3 +1,35 @@
|
|
1 |
import gradio as gr
|
2 |
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
+
from diffusers import DiffusionPipeline
|
4 |
+
|
5 |
+
|
6 |
+
KEYWORDS = [
|
7 |
+
"cute",
|
8 |
+
"small",
|
9 |
+
"cartoon",
|
10 |
+
]
|
11 |
+
|
12 |
+
PIPELINE = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0")
|
13 |
+
PIPELINE.load_lora_weights("artificialguybr/LogoRedmond-LogoLoraForSDXL-V2")
|
14 |
+
|
15 |
+
|
16 |
+
def predict(user_prompt: str):
|
17 |
+
prompt = ", ".join(KEYWORDS)
|
18 |
+
if user_prompt:
|
19 |
+
prompt += ", " + user_prompt
|
20 |
+
|
21 |
+
return PIPELINE(prompt).images[0]
|
22 |
+
|
23 |
+
|
24 |
+
gradio_app = gr.Interface(
|
25 |
+
predict,
|
26 |
+
inputs=[
|
27 |
+
gr.Textbox(),
|
28 |
+
],
|
29 |
+
outputs=[gr.Image()],
|
30 |
+
title="Cute Logo Creator",
|
31 |
+
)
|
32 |
+
|
33 |
+
|
34 |
+
if __name__ == "__main__":
|
35 |
+
gradio_app.launch()
|