Spaces:
Runtime error
Runtime error
Commit
•
0d28f6f
1
Parent(s):
9acec60
fix cache examples error (#4)
Browse files- fix cache examples error (c247f505453206a1df3e1a800615505ed6a6b9a3)
Co-authored-by: Radamés Ajna <[email protected]>
app.py
CHANGED
@@ -110,6 +110,9 @@ def get_example():
|
|
110 |
]
|
111 |
return case
|
112 |
|
|
|
|
|
|
|
113 |
def convert_from_cv2_to_image(img: np.ndarray) -> Image:
|
114 |
return Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
115 |
|
@@ -401,12 +404,13 @@ with gr.Blocks(css=css) as demo:
|
|
401 |
examples=get_example(),
|
402 |
inputs=[face_files, prompt, style, negative_prompt],
|
403 |
run_on_click=True,
|
404 |
-
fn=
|
405 |
-
outputs=[
|
406 |
cache_examples=True
|
407 |
)
|
408 |
|
409 |
gr.Markdown(article)
|
410 |
|
|
|
411 |
demo.queue(api_open=False)
|
412 |
demo.launch()
|
|
|
110 |
]
|
111 |
return case
|
112 |
|
113 |
+
def run_for_examples(face_files, prompt, style, negative_prompt):
|
114 |
+
return generate_image(face_files, None, prompt, negative_prompt, style, True, 30, 0.8, 0.8, 5, 42)
|
115 |
+
|
116 |
def convert_from_cv2_to_image(img: np.ndarray) -> Image:
|
117 |
return Image.fromarray(cv2.cvtColor(img, cv2.COLOR_BGR2RGB))
|
118 |
|
|
|
404 |
examples=get_example(),
|
405 |
inputs=[face_files, prompt, style, negative_prompt],
|
406 |
run_on_click=True,
|
407 |
+
fn=run_for_examples,
|
408 |
+
outputs=[gallery, usage_tips],
|
409 |
cache_examples=True
|
410 |
)
|
411 |
|
412 |
gr.Markdown(article)
|
413 |
|
414 |
+
|
415 |
demo.queue(api_open=False)
|
416 |
demo.launch()
|