Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
-
|
4 |
-
|
5 |
def generate_text(prompt, quality="High (Default)"):
|
6 |
-
length_dict = {"Low": 50, "High (Default)": 100, "
|
7 |
length = length_dict[quality]
|
8 |
-
return
|
|
|
|
|
|
|
|
|
9 |
|
10 |
iface = gr.Interface(
|
11 |
fn=generate_text,
|
|
|
1 |
import gradio as gr
|
2 |
+
from kandinsky2 import get_kandinsky2
|
3 |
+
model = get_kandinsky2('cpu', task_type='text2img', cache_dir='/tmp/kandinsky2', model_version='2.1', use_flash_attention=False)
|
|
|
4 |
def generate_text(prompt, quality="High (Default)"):
|
5 |
+
length_dict = {"Low": 50, "High (Default)": 100, "Ultra": 150}
|
6 |
length = length_dict[quality]
|
7 |
+
return model.generate_text2img('''red cat, 4k photo''', num_steps=length,
|
8 |
+
batch_size=1, guidance_scale=4,
|
9 |
+
h=768, w=768
|
10 |
+
,sampler='p_sampler', prior_cf_scale=4,
|
11 |
+
prior_steps="5",)[0]
|
12 |
|
13 |
iface = gr.Interface(
|
14 |
fn=generate_text,
|