ar0551 commited on
Commit
3952f36
·
verified ·
1 Parent(s): 55fde07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -5,6 +5,7 @@ import numpy as np
5
  import cv2
6
  from PIL import Image
7
  import spaces
 
8
 
9
  # 🌟 Auto-detect device (CPU/GPU)
10
  device = "cuda"
@@ -57,8 +58,12 @@ def generate_image(prompt, input_image, low_threshold, high_threshold, strength,
57
  controlnet_conditioning_scale=float(controlnet_conditioning_scale),
58
  strength=strength
59
  ).images[0]
 
 
 
 
60
 
61
- return edge_detected, result
62
 
63
  # 🖥️ Gradio UI
64
  with gr.Blocks() as demo:
 
5
  import cv2
6
  from PIL import Image
7
  import spaces
8
+ import io
9
 
10
  # 🌟 Auto-detect device (CPU/GPU)
11
  device = "cuda"
 
58
  controlnet_conditioning_scale=float(controlnet_conditioning_scale),
59
  strength=strength
60
  ).images[0]
61
+
62
+ result_buffer = io.BytesIO()
63
+ result.save(result_buffer, format="JPEG")
64
+ result_buffer.seek(0)
65
 
66
+ return edge_detected, result_buffer
67
 
68
  # 🖥️ Gradio UI
69
  with gr.Blocks() as demo: