Spaces:
Runtime error
Runtime error
Layout changes
Browse files
app.py
CHANGED
@@ -28,7 +28,7 @@ class Demo:
|
|
28 |
|
29 |
def layout(self):
|
30 |
with gr.Row():
|
31 |
-
with gr.Column() as training_column:
|
32 |
self.prompt_input = gr.Text(
|
33 |
placeholder="Enter prompt...",
|
34 |
label="Prompt to Erase",
|
@@ -66,15 +66,24 @@ class Demo:
|
|
66 |
)
|
67 |
|
68 |
|
69 |
-
with gr.Column() as inference_column:
|
70 |
|
71 |
with gr.Row():
|
72 |
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
|
79 |
with gr.Row():
|
80 |
|
@@ -95,6 +104,7 @@ class Demo:
|
|
95 |
)
|
96 |
self.infr_button.click(self.inference, inputs = [
|
97 |
self.prompt_input_infr,
|
|
|
98 |
],
|
99 |
outputs=[
|
100 |
self.image_new,
|
@@ -156,7 +166,7 @@ class Demo:
|
|
156 |
self.training = False
|
157 |
|
158 |
|
159 |
-
def inference(self, prompt):
|
160 |
|
161 |
if self.generating:
|
162 |
return [None, None]
|
@@ -165,6 +175,8 @@ class Demo:
|
|
165 |
|
166 |
self.diffuser.unet.load_state_dict(self.model_orig_sd)
|
167 |
|
|
|
|
|
168 |
images = self.diffuser(
|
169 |
prompt,
|
170 |
n_steps=50,
|
|
|
28 |
|
29 |
def layout(self):
|
30 |
with gr.Row():
|
31 |
+
with gr.Column(scale=1) as training_column:
|
32 |
self.prompt_input = gr.Text(
|
33 |
placeholder="Enter prompt...",
|
34 |
label="Prompt to Erase",
|
|
|
66 |
)
|
67 |
|
68 |
|
69 |
+
with gr.Column(scale=2) as inference_column:
|
70 |
|
71 |
with gr.Row():
|
72 |
|
73 |
+
with gr.Column(scale=4):
|
74 |
+
|
75 |
+
self.prompt_input_infr = gr.Text(
|
76 |
+
placeholder="Enter prompt...",
|
77 |
+
label="Prompt",
|
78 |
+
info="Prompt to generate"
|
79 |
+
)
|
80 |
+
|
81 |
+
with gr.Column(scale=1):
|
82 |
+
|
83 |
+
self.seed_infr = gr.Number(
|
84 |
+
label="Seed",
|
85 |
+
value=42
|
86 |
+
)
|
87 |
|
88 |
with gr.Row():
|
89 |
|
|
|
104 |
)
|
105 |
self.infr_button.click(self.inference, inputs = [
|
106 |
self.prompt_input_infr,
|
107 |
+
self.seed_infr
|
108 |
],
|
109 |
outputs=[
|
110 |
self.image_new,
|
|
|
166 |
self.training = False
|
167 |
|
168 |
|
169 |
+
def inference(self, prompt, seed, pbar = gr.Progress(track_tqdm=True)):
|
170 |
|
171 |
if self.generating:
|
172 |
return [None, None]
|
|
|
175 |
|
176 |
self.diffuser.unet.load_state_dict(self.model_orig_sd)
|
177 |
|
178 |
+
self.diffuser._seed = seed
|
179 |
+
|
180 |
images = self.diffuser(
|
181 |
prompt,
|
182 |
n_steps=50,
|