Spaces:
Running
on
Zero
Running
on
Zero
Update app_v3.py
Browse files
app_v3.py
CHANGED
@@ -22,7 +22,7 @@ from typing import Generator
|
|
22 |
# from peft import PeftModel, PeftConfig
|
23 |
import gradio as gr
|
24 |
from huggingface_hub import CommitScheduler, HfApi, logging
|
25 |
-
from debug import log_params, scheduler
|
26 |
logging.set_verbosity_debug()
|
27 |
|
28 |
huggingface_token = os.getenv("HUGGINFACE_TOKEN")
|
@@ -105,7 +105,7 @@ def generate_caption(control_image):
|
|
105 |
return None, None
|
106 |
|
107 |
# Generate a detailed caption
|
108 |
-
mcaption = model.caption(control_image, length="
|
109 |
detailed_caption = mcaption["caption"]
|
110 |
print(f"Detailed caption: {detailed_caption}")
|
111 |
|
@@ -152,7 +152,12 @@ def process_image(control_image, user_prompt, system_prompt, scale, steps,
|
|
152 |
seed=seed,
|
153 |
guidance_end=guidance_end
|
154 |
)
|
155 |
-
|
|
|
|
|
|
|
|
|
|
|
156 |
log_params(final_prompt, scale, steps, controlnet_conditioning_scale, guidance_scale, seed, guidance_end, control_image, image)
|
157 |
yield f"Completed! Used prompt: {final_prompt}", image, final_prompt
|
158 |
except Exception as e:
|
|
|
22 |
# from peft import PeftModel, PeftConfig
|
23 |
import gradio as gr
|
24 |
from huggingface_hub import CommitScheduler, HfApi, logging
|
25 |
+
from debug import log_params, scheduler, save_image
|
26 |
logging.set_verbosity_debug()
|
27 |
|
28 |
huggingface_token = os.getenv("HUGGINFACE_TOKEN")
|
|
|
105 |
return None, None
|
106 |
|
107 |
# Generate a detailed caption
|
108 |
+
mcaption = model.caption(control_image, length="short")
|
109 |
detailed_caption = mcaption["caption"]
|
110 |
print(f"Detailed caption: {detailed_caption}")
|
111 |
|
|
|
152 |
seed=seed,
|
153 |
guidance_end=guidance_end
|
154 |
)
|
155 |
+
|
156 |
+
try:
|
157 |
+
debug_img = Image.open(image.save("/tmp/" + str(seed) + "output.png"))
|
158 |
+
save_image("/tmp/" + str(seed) + "output.png", debug_img)
|
159 |
+
except Exception as e:
|
160 |
+
print("Error 160: " + str(e))
|
161 |
log_params(final_prompt, scale, steps, controlnet_conditioning_scale, guidance_scale, seed, guidance_end, control_image, image)
|
162 |
yield f"Completed! Used prompt: {final_prompt}", image, final_prompt
|
163 |
except Exception as e:
|