Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -2245,8 +2245,13 @@ def run_lora(prompt, image_input, image_strength, cfg_scale, steps, selected_ind
|
|
2245 |
final_image = image
|
2246 |
progress_bar = f'<div class="progress-container"><div class="progress-bar" style="--current: {step_counter}; --total: {steps};"></div></div>'
|
2247 |
yield image, seed, gr.update(value=progress_bar, visible=True)
|
2248 |
-
|
2249 |
-
|
|
|
|
|
|
|
|
|
|
|
2250 |
|
2251 |
def get_huggingface_safetensors(link):
|
2252 |
split_link = link.split("/")
|
@@ -2379,6 +2384,7 @@ with gr.Blocks(theme="YTheme/Minecraft", css=css, delete_cache=(60, 60)) as app:
|
|
2379 |
with gr.Column():
|
2380 |
progress_bar = gr.Markdown(elem_id="progress",visible=False)
|
2381 |
result = gr.Image(label="Generated Image")
|
|
|
2382 |
|
2383 |
with gr.Row():
|
2384 |
with gr.Accordion("Advanced Settings", open=False):
|
|
|
2245 |
final_image = image
|
2246 |
progress_bar = f'<div class="progress-container"><div class="progress-bar" style="--current: {step_counter}; --total: {steps};"></div></div>'
|
2247 |
yield image, seed, gr.update(value=progress_bar, visible=True)
|
2248 |
+
# Save and encode final image
|
2249 |
+
temp_file = tempfile.NamedTemporaryFile(delete=False, suffix=".png")
|
2250 |
+
final_image.save(temp_file.name, "PNG")
|
2251 |
+
with open(temp_file.name, "rb") as f:
|
2252 |
+
base64_str = base64.b64encode(f.read()).decode("utf-8")
|
2253 |
+
|
2254 |
+
yield final_image, temp_file.name, base64_str, seed, gr.update(value=progress_bar, visible=False)
|
2255 |
|
2256 |
def get_huggingface_safetensors(link):
|
2257 |
split_link = link.split("/")
|
|
|
2384 |
with gr.Column():
|
2385 |
progress_bar = gr.Markdown(elem_id="progress",visible=False)
|
2386 |
result = gr.Image(label="Generated Image")
|
2387 |
+
base64_output = gr.Textbox(label="Base64 Encoded Image")
|
2388 |
|
2389 |
with gr.Row():
|
2390 |
with gr.Accordion("Advanced Settings", open=False):
|