Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -79,14 +79,18 @@ def generate_random_string(length):
|
|
79 |
|
80 |
@spaces.GPU(duration=50)
|
81 |
def Piper(_do):
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
|
|
|
|
|
|
|
|
90 |
|
91 |
def infer(prompt_en):
|
92 |
name = generate_random_string(12)+".png"
|
@@ -94,7 +98,11 @@ def infer(prompt_en):
|
|
94 |
_do = 'photographed realistic scene'
|
95 |
else:
|
96 |
_do = f'photographed { prompt_en } realistic scene'
|
97 |
-
Piper(_do)
|
|
|
|
|
|
|
|
|
98 |
return name
|
99 |
|
100 |
css="""
|
|
|
79 |
|
80 |
@spaces.GPU(duration=50)
|
81 |
def Piper(_do):
|
82 |
+
try:
|
83 |
+
retu = pipe(
|
84 |
+
_do,
|
85 |
+
height=512,
|
86 |
+
width=768,
|
87 |
+
num_inference_steps=50,
|
88 |
+
max_sequence_length=512,
|
89 |
+
guidance_scale=2
|
90 |
+
)
|
91 |
+
return retu
|
92 |
+
except:
|
93 |
+
return ""
|
94 |
|
95 |
def infer(prompt_en):
|
96 |
name = generate_random_string(12)+".png"
|
|
|
98 |
_do = 'photographed realistic scene'
|
99 |
else:
|
100 |
_do = f'photographed { prompt_en } realistic scene'
|
101 |
+
output = Piper(_do)
|
102 |
+
if output == "":
|
103 |
+
return output
|
104 |
+
else:
|
105 |
+
output.images[0].save(name)
|
106 |
return name
|
107 |
|
108 |
css="""
|