zhiweili
commited on
Commit
Β·
9c7e31f
1
Parent(s):
4f4e5ea
fix UnboundLocalError
Browse files- app_onediff.py +4 -7
app_onediff.py
CHANGED
|
@@ -60,7 +60,6 @@ base_pipe = AutoPipelineForText2Image.from_pretrained(
|
|
| 60 |
base_pipe.to(device)
|
| 61 |
|
| 62 |
# base_pipe = nexfort_compile(base_pipe)
|
| 63 |
-
compiled_pipe = base_pipe
|
| 64 |
|
| 65 |
from gfpgan.utils import GFPGANer
|
| 66 |
from basicsr.archs.srvgg_arch import SRVGGNetCompact
|
|
@@ -85,16 +84,14 @@ def create_demo() -> gr.Blocks:
|
|
| 85 |
prompt:str,
|
| 86 |
steps:int,
|
| 87 |
):
|
|
|
|
| 88 |
run_task_time = 0
|
| 89 |
time_cost_str = ''
|
| 90 |
run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
|
| 91 |
-
if
|
| 92 |
print("---------->Recompile<----------")
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
else:
|
| 96 |
-
target_pipe = compiled_pipe
|
| 97 |
-
generated_image = target_pipe(
|
| 98 |
prompt=prompt,
|
| 99 |
num_inference_steps=steps,
|
| 100 |
).images[0]
|
|
|
|
| 60 |
base_pipe.to(device)
|
| 61 |
|
| 62 |
# base_pipe = nexfort_compile(base_pipe)
|
|
|
|
| 63 |
|
| 64 |
from gfpgan.utils import GFPGANer
|
| 65 |
from basicsr.archs.srvgg_arch import SRVGGNetCompact
|
|
|
|
| 84 |
prompt:str,
|
| 85 |
steps:int,
|
| 86 |
):
|
| 87 |
+
global compiled_pipe
|
| 88 |
run_task_time = 0
|
| 89 |
time_cost_str = ''
|
| 90 |
run_task_time, time_cost_str = get_time_cost(run_task_time, time_cost_str)
|
| 91 |
+
if not compiled_pipe:
|
| 92 |
print("---------->Recompile<----------")
|
| 93 |
+
compiled_pipe = nexfort_compile(base_pipe)
|
| 94 |
+
generated_image = compiled_pipe(
|
|
|
|
|
|
|
|
|
|
| 95 |
prompt=prompt,
|
| 96 |
num_inference_steps=steps,
|
| 97 |
).images[0]
|