Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,15 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
|
| 3 |
model = gr.load("models/Purz/face-projection")
|
| 4 |
|
| 5 |
-
def generate_image(text):
|
| 6 |
-
if
|
|
|
|
|
|
|
|
|
|
| 7 |
print(f"Using example: {text}")
|
|
|
|
| 8 |
return model(text)
|
| 9 |
|
| 10 |
examples = [
|
|
@@ -13,10 +18,13 @@ examples = [
|
|
| 13 |
|
| 14 |
interface = gr.Interface(
|
| 15 |
fn=generate_image,
|
| 16 |
-
inputs=
|
|
|
|
|
|
|
|
|
|
| 17 |
outputs=gr.Image(label="Generated Image"),
|
| 18 |
examples=examples,
|
| 19 |
theme="NoCrypt/miku",
|
| 20 |
)
|
| 21 |
|
| 22 |
-
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, seed):
|
| 7 |
+
if seed is not None:
|
| 8 |
+
random.seed(seed)
|
| 9 |
+
|
| 10 |
+
if text in [example[0] for example in examples]:
|
| 11 |
print(f"Using example: {text}")
|
| 12 |
+
|
| 13 |
return model(text)
|
| 14 |
|
| 15 |
examples = [
|
|
|
|
| 18 |
|
| 19 |
interface = gr.Interface(
|
| 20 |
fn=generate_image,
|
| 21 |
+
inputs=[
|
| 22 |
+
gr.Textbox(label="Type here your imagination:"),
|
| 23 |
+
gr.Slider(minimum=0, maximum=10000, step=1, label="Seed (optional)")
|
| 24 |
+
],
|
| 25 |
outputs=gr.Image(label="Generated Image"),
|
| 26 |
examples=examples,
|
| 27 |
theme="NoCrypt/miku",
|
| 28 |
)
|
| 29 |
|
| 30 |
+
interface.launch()
|