Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -83,23 +83,23 @@ def generate_random_string(length):
|
|
| 83 |
characters = string.ascii_letters + string.digits
|
| 84 |
return ''.join(random.choice(characters) for _ in range(length))
|
| 85 |
|
| 86 |
-
@spaces.GPU(duration=
|
| 87 |
def Piper(_do,_dont):
|
| 88 |
return pipe(
|
| 89 |
_do,
|
| 90 |
height=320,
|
| 91 |
-
width=
|
| 92 |
negative_prompt=_dont,
|
| 93 |
-
num_inference_steps=
|
| 94 |
-
guidance_scale=
|
| 95 |
)
|
| 96 |
|
| 97 |
def infer(prompt_en,prompt2_en):
|
| 98 |
name = generate_random_string(12)+".png"
|
| 99 |
if prompt_en == "":
|
| 100 |
-
_do = 'natural
|
| 101 |
else:
|
| 102 |
-
_do = f'photographed { prompt_en }, natural
|
| 103 |
if prompt2_en == "":
|
| 104 |
_dont = 'smooth texture, fictional proportions, blurred content, distorted items, deformed palms, logos and signs, texts and prints'
|
| 105 |
else:
|
|
@@ -108,7 +108,7 @@ def infer(prompt_en,prompt2_en):
|
|
| 108 |
return name
|
| 109 |
|
| 110 |
css="""
|
| 111 |
-
input::placeholder {
|
| 112 |
text-align: center !important;
|
| 113 |
}
|
| 114 |
*, *::placeholder {
|
|
@@ -128,7 +128,7 @@ footer {
|
|
| 128 |
max-width: 15cm !important;
|
| 129 |
}
|
| 130 |
.image-container {
|
| 131 |
-
aspect-ratio:
|
| 132 |
}
|
| 133 |
.dropdown-arrow {
|
| 134 |
display: none !important;
|
|
@@ -174,8 +174,6 @@ with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo:
|
|
| 174 |
with gr.Row():
|
| 175 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
| 176 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
| 177 |
-
with gr.Row():
|
| 178 |
-
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
| 179 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
| 180 |
|
| 181 |
def _ret(idx,p1,p2):
|
|
|
|
| 83 |
characters = string.ascii_letters + string.digits
|
| 84 |
return ''.join(random.choice(characters) for _ in range(length))
|
| 85 |
|
| 86 |
+
@spaces.GPU(duration=50)
|
| 87 |
def Piper(_do,_dont):
|
| 88 |
return pipe(
|
| 89 |
_do,
|
| 90 |
height=320,
|
| 91 |
+
width=640,
|
| 92 |
negative_prompt=_dont,
|
| 93 |
+
num_inference_steps=200,
|
| 94 |
+
guidance_scale=10
|
| 95 |
)
|
| 96 |
|
| 97 |
def infer(prompt_en,prompt2_en):
|
| 98 |
name = generate_random_string(12)+".png"
|
| 99 |
if prompt_en == "":
|
| 100 |
+
_do = 'natural coloring, epic scene, reasonable proportions, realistic content, highly detailed photograph'
|
| 101 |
else:
|
| 102 |
+
_do = f'photographed { prompt_en }, natural coloring, epic scene, reasonable proportions, realistic content, highly detailed photograph'
|
| 103 |
if prompt2_en == "":
|
| 104 |
_dont = 'smooth texture, fictional proportions, blurred content, distorted items, deformed palms, logos and signs, texts and prints'
|
| 105 |
else:
|
|
|
|
| 108 |
return name
|
| 109 |
|
| 110 |
css="""
|
| 111 |
+
input, input::placeholder {
|
| 112 |
text-align: center !important;
|
| 113 |
}
|
| 114 |
*, *::placeholder {
|
|
|
|
| 128 |
max-width: 15cm !important;
|
| 129 |
}
|
| 130 |
.image-container {
|
| 131 |
+
aspect-ratio: 640 / 320 !important;
|
| 132 |
}
|
| 133 |
.dropdown-arrow {
|
| 134 |
display: none !important;
|
|
|
|
| 174 |
with gr.Row():
|
| 175 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
| 176 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
|
|
|
|
|
|
| 177 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
| 178 |
|
| 179 |
def _ret(idx,p1,p2):
|