Spaces:
Runtime error
Runtime error
Dhruv Diddi
commited on
Commit
·
447282e
1
Parent(s):
9a2b76b
fix: one button generate
Browse files
app.py
CHANGED
@@ -13,9 +13,6 @@ stable_diffusion = gr.Blocks.load(name="spaces/stabilityai/stable-diffusion")
|
|
13 |
|
14 |
title="Any Text to Stable Diffusion"
|
15 |
|
16 |
-
def get_images(prompt):
|
17 |
-
gallery_dir = stable_diffusion(prompt, fn_index=2)
|
18 |
-
return [os.path.join(gallery_dir, img) for img in os.listdir(gallery_dir)]
|
19 |
|
20 |
def get_translation(text):
|
21 |
lang_detected = lt.detect(text)[0]['language']
|
@@ -24,6 +21,10 @@ def get_translation(text):
|
|
24 |
print(english_translated)
|
25 |
return english_translated
|
26 |
|
|
|
|
|
|
|
|
|
27 |
|
28 |
css = """
|
29 |
.container {
|
@@ -246,7 +247,7 @@ with gr.Blocks(css=css) as demo:
|
|
246 |
with gr.Row():
|
247 |
clear_btn = gr.Button(value="Clear")
|
248 |
translate_btn = gr.Button(value="Translate", elem_id="translate_btn")
|
249 |
-
diffuse_btn = gr.Button(value="
|
250 |
|
251 |
clear_btn.click(fn=lambda value: gr.update(value=""), inputs=clear_btn, outputs=translated_output)
|
252 |
|
@@ -301,7 +302,7 @@ with gr.Blocks(css=css) as demo:
|
|
301 |
|
302 |
diffuse_btn.click(get_images,
|
303 |
inputs = [
|
304 |
-
|
305 |
],
|
306 |
outputs = sd_output
|
307 |
)
|
@@ -315,4 +316,4 @@ with gr.Blocks(css=css) as demo:
|
|
315 |
|
316 |
|
317 |
if __name__ == "__main__":
|
318 |
-
demo.launch()
|
|
|
13 |
|
14 |
title="Any Text to Stable Diffusion"
|
15 |
|
|
|
|
|
|
|
16 |
|
17 |
def get_translation(text):
|
18 |
lang_detected = lt.detect(text)[0]['language']
|
|
|
21 |
print(english_translated)
|
22 |
return english_translated
|
23 |
|
24 |
+
def get_images(prompt):
|
25 |
+
prompt_t = get_translation(prompt)
|
26 |
+
gallery_dir = stable_diffusion(prompt_t, fn_index=2)
|
27 |
+
return [os.path.join(gallery_dir, img) for img in os.listdir(gallery_dir)]
|
28 |
|
29 |
css = """
|
30 |
.container {
|
|
|
247 |
with gr.Row():
|
248 |
clear_btn = gr.Button(value="Clear")
|
249 |
translate_btn = gr.Button(value="Translate", elem_id="translate_btn")
|
250 |
+
diffuse_btn = gr.Button(value="Translate >> SD!", elem_id="diffuse_btn")
|
251 |
|
252 |
clear_btn.click(fn=lambda value: gr.update(value=""), inputs=clear_btn, outputs=translated_output)
|
253 |
|
|
|
302 |
|
303 |
diffuse_btn.click(get_images,
|
304 |
inputs = [
|
305 |
+
enter_prompt
|
306 |
],
|
307 |
outputs = sd_output
|
308 |
)
|
|
|
316 |
|
317 |
|
318 |
if __name__ == "__main__":
|
319 |
+
demo.launch()
|