Spaces:
Runtime error
Runtime error
Add harcoded keywords (#1)
Browse files- Add harcoded keys (1d351f53e3c5f53c9922a0da1c24446afcd42fd9)
- Nits (06c2073ef7c0bde7ffb8912b5924613cb844fe15)
Co-authored-by: Manon Blanco <mblanco@users.noreply.huggingface.co>
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()
|