Spaces:
Running
on
Zero
Running
on
Zero
attempt 4
Browse files
app_v3.py
CHANGED
@@ -70,7 +70,7 @@ def generate_image(prompt, scale, steps, control_image, controlnet_conditioning_
|
|
70 |
control_guidance_start=0.0,
|
71 |
control_guidance_end=guidance_end,
|
72 |
).images[0]
|
73 |
-
|
74 |
return image
|
75 |
|
76 |
def combine_caption_focus(caption, focus):
|
@@ -108,10 +108,11 @@ def process_image(control_image, user_prompt, system_prompt, scale, steps,
|
|
108 |
guidance_end, temperature, top_p, max_new_tokens, log_prompt):
|
109 |
# Initialize with empty caption
|
110 |
final_prompt = user_prompt.strip()
|
111 |
-
|
112 |
# If no user prompt provided, generate a caption first
|
113 |
if not final_prompt:
|
114 |
# Generate a detailed caption
|
|
|
115 |
mcaption = model.caption(control_image, length="normal")
|
116 |
detailed_caption = mcaption["caption"]
|
117 |
final_prompt = detailed_caption
|
@@ -135,15 +136,9 @@ def process_image(control_image, user_prompt, system_prompt, scale, steps,
|
|
135 |
log_params(final_prompt, scale, steps, controlnet_conditioning_scale, guidance_scale, seed, guidance_end, control_image, image)
|
136 |
yield f"Completed! Used prompt: {final_prompt}", image, final_prompt
|
137 |
except Exception as e:
|
|
|
138 |
yield f"Error: {str(e)}", None, None
|
139 |
|
140 |
-
def handle_outputs(outputs):
|
141 |
-
if isinstance(outputs, dict) and outputs.get("__type__") == "update_caption":
|
142 |
-
return outputs["caption"], None
|
143 |
-
return outputs
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
with gr.Blocks(title="FLUX Turbo Upscaler", fill_height=True) as demo:
|
148 |
gr.Markdown("⚠️ WIP SPACE - UNFINISHED & BUGGY")
|
149 |
with gr.Row():
|
|
|
70 |
control_guidance_start=0.0,
|
71 |
control_guidance_end=guidance_end,
|
72 |
).images[0]
|
73 |
+
print("Type: " + str(type(image)))
|
74 |
return image
|
75 |
|
76 |
def combine_caption_focus(caption, focus):
|
|
|
108 |
guidance_end, temperature, top_p, max_new_tokens, log_prompt):
|
109 |
# Initialize with empty caption
|
110 |
final_prompt = user_prompt.strip()
|
111 |
+
print("User generated prompt: " + final_prompt)
|
112 |
# If no user prompt provided, generate a caption first
|
113 |
if not final_prompt:
|
114 |
# Generate a detailed caption
|
115 |
+
print("Generating caption...")
|
116 |
mcaption = model.caption(control_image, length="normal")
|
117 |
detailed_caption = mcaption["caption"]
|
118 |
final_prompt = detailed_caption
|
|
|
136 |
log_params(final_prompt, scale, steps, controlnet_conditioning_scale, guidance_scale, seed, guidance_end, control_image, image)
|
137 |
yield f"Completed! Used prompt: {final_prompt}", image, final_prompt
|
138 |
except Exception as e:
|
139 |
+
print("Error: " + str(e))
|
140 |
yield f"Error: {str(e)}", None, None
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
with gr.Blocks(title="FLUX Turbo Upscaler", fill_height=True) as demo:
|
143 |
gr.Markdown("⚠️ WIP SPACE - UNFINISHED & BUGGY")
|
144 |
with gr.Row():
|