Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -40,20 +40,17 @@ if torch.cuda.is_available():
|
|
40 |
@spaces.GPU()
|
41 |
def generate_image(
|
42 |
prompt,
|
43 |
-
negative="low quality",
|
44 |
width=768,
|
45 |
height=1024,
|
46 |
scale=3.5,
|
47 |
steps=24):
|
48 |
|
49 |
prompt = str(translator.translate(prompt, 'English'))
|
50 |
-
negative_prompt = str(translator.translate(negative, 'English'))
|
51 |
|
52 |
print(f'prompt:{prompt}')
|
53 |
|
54 |
image = pipe(
|
55 |
prompt,
|
56 |
-
negative_prompt=negative,
|
57 |
width=width,
|
58 |
height=height,
|
59 |
guidance_scale=scale,
|
@@ -82,8 +79,6 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
|
82 |
submit = gr.Button(scale=1, variant='primary')
|
83 |
img = gr.Image(label='Flux Generated Image')
|
84 |
with gr.Accordion("Advanced Options", open=False):
|
85 |
-
with gr.Row():
|
86 |
-
negative = gr.Textbox(label="Negative prompt", value="low quality")
|
87 |
with gr.Row():
|
88 |
width = gr.Slider(
|
89 |
label="Width",
|
@@ -123,11 +118,11 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
|
|
123 |
)
|
124 |
|
125 |
prompt.submit(fn=generate_image,
|
126 |
-
inputs=[prompt,
|
127 |
outputs=img,
|
128 |
)
|
129 |
submit.click(fn=generate_image,
|
130 |
-
inputs=[prompt,
|
131 |
outputs=img,
|
132 |
)
|
133 |
|
|
|
40 |
@spaces.GPU()
|
41 |
def generate_image(
|
42 |
prompt,
|
|
|
43 |
width=768,
|
44 |
height=1024,
|
45 |
scale=3.5,
|
46 |
steps=24):
|
47 |
|
48 |
prompt = str(translator.translate(prompt, 'English'))
|
|
|
49 |
|
50 |
print(f'prompt:{prompt}')
|
51 |
|
52 |
image = pipe(
|
53 |
prompt,
|
|
|
54 |
width=width,
|
55 |
height=height,
|
56 |
guidance_scale=scale,
|
|
|
79 |
submit = gr.Button(scale=1, variant='primary')
|
80 |
img = gr.Image(label='Flux Generated Image')
|
81 |
with gr.Accordion("Advanced Options", open=False):
|
|
|
|
|
82 |
with gr.Row():
|
83 |
width = gr.Slider(
|
84 |
label="Width",
|
|
|
118 |
)
|
119 |
|
120 |
prompt.submit(fn=generate_image,
|
121 |
+
inputs=[prompt, width, height, scale, steps],
|
122 |
outputs=img,
|
123 |
)
|
124 |
submit.click(fn=generate_image,
|
125 |
+
inputs=[prompt, width, height, scale, steps],
|
126 |
outputs=img,
|
127 |
)
|
128 |
|