Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,27 +1,23 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
model = gr.load("models/Purz/face-projection")
|
4 |
|
5 |
-
def generate_image(text, negative_prompt
|
6 |
-
if not negative_prompt:
|
7 |
-
negative_prompt = "low quality, distorted, overly saturated, text artifacts, out of focus"
|
8 |
-
|
9 |
-
print(f"Generating with prompt: {text}, negative prompt: {negative_prompt}")
|
10 |
-
|
11 |
return model(text, negative_prompt=negative_prompt)
|
12 |
|
13 |
examples = [
|
14 |
-
["Humanoid Cat Warrior, Full View", "
|
15 |
-
["Warhammer Sisterhood", "
|
16 |
-
["Future Robots war", "
|
17 |
-
["Fantasy dragon", "
|
18 |
]
|
19 |
|
20 |
interface = gr.Interface(
|
21 |
fn=generate_image,
|
22 |
inputs=[
|
23 |
gr.Textbox(label="Type here your imagination:", placeholder="Type or click an example..."),
|
24 |
-
gr.Textbox(label="Negative Prompt (optional)", placeholder="
|
25 |
],
|
26 |
outputs=gr.Image(label="Generated Image"),
|
27 |
examples=examples,
|
@@ -29,4 +25,4 @@ interface = gr.Interface(
|
|
29 |
description="Sorry for the inconvenience. The model is currently running on the CPU, which might affect performance. We appreciate your understanding.",
|
30 |
)
|
31 |
|
32 |
-
interface.launch()
|
|
|
1 |
import gradio as gr
|
2 |
+
import random
|
3 |
|
4 |
model = gr.load("models/Purz/face-projection")
|
5 |
|
6 |
+
def generate_image(text, negative_prompt):
|
|
|
|
|
|
|
|
|
|
|
7 |
return model(text, negative_prompt=negative_prompt)
|
8 |
|
9 |
examples = [
|
10 |
+
["Humanoid Cat Warrior, Full View", "No background"],
|
11 |
+
["Warhammer Sisterhood", "No weapons"],
|
12 |
+
["Future Robots war", "No destruction"],
|
13 |
+
["Fantasy dragon", "No fire"],
|
14 |
]
|
15 |
|
16 |
interface = gr.Interface(
|
17 |
fn=generate_image,
|
18 |
inputs=[
|
19 |
gr.Textbox(label="Type here your imagination:", placeholder="Type or click an example..."),
|
20 |
+
gr.Textbox(label="Negative Prompt (optional):", placeholder="Specify what to avoid..."),
|
21 |
],
|
22 |
outputs=gr.Image(label="Generated Image"),
|
23 |
examples=examples,
|
|
|
25 |
description="Sorry for the inconvenience. The model is currently running on the CPU, which might affect performance. We appreciate your understanding.",
|
26 |
)
|
27 |
|
28 |
+
interface.launch()
|