Spaces:
Running
Running
Remove examples
Browse files
app.py
CHANGED
@@ -1,17 +1,12 @@
|
|
1 |
import random
|
2 |
|
3 |
import gradio as gr
|
4 |
-
from datasets import load_dataset
|
5 |
|
6 |
from client import Inference
|
7 |
|
8 |
MAX_SEED = 2 ** 31 - 1
|
9 |
client = Inference()
|
10 |
|
11 |
-
def load_examples():
|
12 |
-
ds = load_dataset("k-mktr/improved-flux-prompts", split="train")
|
13 |
-
return [[item] for item in ds.shuffle()["prompt"][:20]]
|
14 |
-
|
15 |
def generate(
|
16 |
prompt,
|
17 |
seed=None,
|
@@ -53,14 +48,6 @@ with gr.Blocks(
|
|
53 |
max_lines=1
|
54 |
)
|
55 |
btn = gr.Button("Generate", variant="primary")
|
56 |
-
|
57 |
-
with gr.Tab("💡 Examples"):
|
58 |
-
examples = gr.Examples(
|
59 |
-
load_examples(),
|
60 |
-
inputs=[prompt],
|
61 |
-
examples_per_page=2
|
62 |
-
)
|
63 |
-
randomize_btn = gr.Button("See more")
|
64 |
|
65 |
with gr.Tab("⚙️ Settings"):
|
66 |
with gr.Row():
|
@@ -105,9 +92,6 @@ with gr.Blocks(
|
|
105 |
* Running on [Gradio](https://www.gradio.app) v{gr.__version__}
|
106 |
""")
|
107 |
|
108 |
-
def update_examples():
|
109 |
-
return gr.update(samples=load_examples())
|
110 |
-
|
111 |
def add_to_gallery(img, gallery):
|
112 |
if gallery is None:
|
113 |
gallery = []
|
@@ -118,22 +102,6 @@ with gr.Blocks(
|
|
118 |
def clear_gallery():
|
119 |
return []
|
120 |
|
121 |
-
app.load(
|
122 |
-
update_examples,
|
123 |
-
inputs=None,
|
124 |
-
outputs=[examples.dataset],
|
125 |
-
queue=False,
|
126 |
-
show_api=False
|
127 |
-
)
|
128 |
-
|
129 |
-
randomize_btn.click(
|
130 |
-
update_examples,
|
131 |
-
inputs=None,
|
132 |
-
outputs=[examples.dataset],
|
133 |
-
queue=False,
|
134 |
-
show_api=False
|
135 |
-
)
|
136 |
-
|
137 |
clear_btn.click(
|
138 |
clear_gallery,
|
139 |
inputs=None,
|
|
|
1 |
import random
|
2 |
|
3 |
import gradio as gr
|
|
|
4 |
|
5 |
from client import Inference
|
6 |
|
7 |
MAX_SEED = 2 ** 31 - 1
|
8 |
client = Inference()
|
9 |
|
|
|
|
|
|
|
|
|
10 |
def generate(
|
11 |
prompt,
|
12 |
seed=None,
|
|
|
48 |
max_lines=1
|
49 |
)
|
50 |
btn = gr.Button("Generate", variant="primary")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
with gr.Tab("⚙️ Settings"):
|
53 |
with gr.Row():
|
|
|
92 |
* Running on [Gradio](https://www.gradio.app) v{gr.__version__}
|
93 |
""")
|
94 |
|
|
|
|
|
|
|
95 |
def add_to_gallery(img, gallery):
|
96 |
if gallery is None:
|
97 |
gallery = []
|
|
|
102 |
def clear_gallery():
|
103 |
return []
|
104 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
clear_btn.click(
|
106 |
clear_gallery,
|
107 |
inputs=None,
|