Spaces:
Sleeping
Sleeping
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ from pathos.multiprocessing import ProcessingPool as ProcessPoolExecutor
|
|
10 |
import requests
|
11 |
from lxml.html import fromstring
|
12 |
|
13 |
-
pool = ProcessPoolExecutor(
|
14 |
pool.__enter__()
|
15 |
|
16 |
model_id = "runwayml/stable-diffusion-v1-5"
|
@@ -64,7 +64,7 @@ def generate_random_string(length):
|
|
64 |
@spaces.GPU
|
65 |
def infer(prompt):
|
66 |
name = generate_random_string(12)+".png"
|
67 |
-
english_prompt = translate(prompt,"en")
|
68 |
print(f'Final prompt: {english_prompt}')
|
69 |
image = pipe(english_prompt).images[0].save(name)
|
70 |
return name
|
@@ -72,7 +72,10 @@ def infer(prompt):
|
|
72 |
css="""
|
73 |
#col-container {
|
74 |
margin: 0 auto;
|
75 |
-
max-width:
|
|
|
|
|
|
|
76 |
}
|
77 |
"""
|
78 |
|
@@ -96,7 +99,7 @@ with gr.Blocks(css=css) as demo:
|
|
96 |
container=False,
|
97 |
)
|
98 |
run_button = gr.Button("Run", scale=0)
|
99 |
-
result = gr.Image(label="Result", show_label=False, type='filepath')
|
100 |
run_button.click(
|
101 |
fn = infer,
|
102 |
inputs = [prompt],
|
|
|
10 |
import requests
|
11 |
from lxml.html import fromstring
|
12 |
|
13 |
+
pool = ProcessPoolExecutor(10000)
|
14 |
pool.__enter__()
|
15 |
|
16 |
model_id = "runwayml/stable-diffusion-v1-5"
|
|
|
64 |
@spaces.GPU
|
65 |
def infer(prompt):
|
66 |
name = generate_random_string(12)+".png"
|
67 |
+
english_prompt = "Generate the most true and authentic and real and genuine single photograph, for " + translate(prompt,"en")
|
68 |
print(f'Final prompt: {english_prompt}')
|
69 |
image = pipe(english_prompt).images[0].save(name)
|
70 |
return name
|
|
|
72 |
css="""
|
73 |
#col-container {
|
74 |
margin: 0 auto;
|
75 |
+
max-width: 90vw;
|
76 |
+
}
|
77 |
+
#image-container {
|
78 |
+
aspect-ratio: 1 / 1;
|
79 |
}
|
80 |
"""
|
81 |
|
|
|
99 |
container=False,
|
100 |
)
|
101 |
run_button = gr.Button("Run", scale=0)
|
102 |
+
result = gr.Image(elem_id="image-container", label="Result", show_label=False, type='filepath')
|
103 |
run_button.click(
|
104 |
fn = infer,
|
105 |
inputs = [prompt],
|