Spaces:
Running
Running
Yaron Koresh
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -8,7 +8,7 @@ import requests
|
|
8 |
import gradio as gr
|
9 |
import numpy as np
|
10 |
from lxml.html import fromstring
|
11 |
-
from pathos.multiprocessing import ProcessPool as Pool
|
12 |
#from pathos.threading import ThreadPool as Pool
|
13 |
#from diffusers.pipelines.flux import FluxPipeline
|
14 |
#from diffusers.utils import export_to_gif
|
@@ -217,19 +217,27 @@ with gr.Blocks(theme=gr.themes.Soft(),css=css,js=js) as demo:
|
|
217 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
218 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
219 |
|
220 |
-
def _ret(
|
221 |
-
|
|
|
222 |
v = infer(p1,p2)
|
223 |
-
print(f'Finished
|
224 |
return v
|
|
|
225 |
def _rets(p1,p2):
|
|
|
226 |
p1_en = translate(p1,"english")
|
227 |
p2_en = translate(p2,"english")
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
|
|
|
|
|
|
|
|
|
|
233 |
run_button.click(fn=_rets,inputs=[prompt,prompt2],outputs=result)
|
234 |
|
235 |
demo.queue().launch()
|
|
|
8 |
import gradio as gr
|
9 |
import numpy as np
|
10 |
from lxml.html import fromstring
|
11 |
+
#from pathos.multiprocessing import ProcessPool as Pool
|
12 |
#from pathos.threading import ThreadPool as Pool
|
13 |
#from diffusers.pipelines.flux import FluxPipeline
|
14 |
#from diffusers.utils import export_to_gif
|
|
|
217 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
218 |
result.append(gr.Image(interactive=False,elem_classes="image-container", label="Result", show_label=False, type='filepath', show_share_button=False))
|
219 |
|
220 |
+
def _ret(p1,p2):
|
221 |
+
|
222 |
+
print(f'Starting!')
|
223 |
v = infer(p1,p2)
|
224 |
+
print(f'Finished!')
|
225 |
return v
|
226 |
+
|
227 |
def _rets(p1,p2):
|
228 |
+
|
229 |
p1_en = translate(p1,"english")
|
230 |
p2_en = translate(p2,"english")
|
231 |
+
|
232 |
+
#ln = len(result)
|
233 |
+
#idxs = list(range(ln))
|
234 |
+
#p1s = [p1_en for _ in idxs]
|
235 |
+
#p2s = [p2_en for _ in idxs]
|
236 |
+
#pool = Pool(ln)
|
237 |
+
#return list( pool.imap( _ret, p1s, p2s ) )
|
238 |
+
|
239 |
+
return list( _ret(p1_en,p2_en) )
|
240 |
+
|
241 |
run_button.click(fn=_rets,inputs=[prompt,prompt2],outputs=result)
|
242 |
|
243 |
demo.queue().launch()
|