Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
import spaces
|
| 2 |
import gradio as gr
|
|
|
|
| 3 |
import torch
|
| 4 |
from diffusers import DiffusionPipeline
|
| 5 |
from PIL import Image
|
|
@@ -51,7 +52,7 @@ def process_image(image, num_steps=10, guidance_scale=1.0):
|
|
| 51 |
# Use the mask as the alpha channel
|
| 52 |
original_rgba.putalpha(mask_gray)
|
| 53 |
|
| 54 |
-
return original_rgba, "✅ Image processed successfully!"
|
| 55 |
|
| 56 |
except Exception as e:
|
| 57 |
return None, f"❌ Error: {str(e)}"
|
|
@@ -99,8 +100,8 @@ with gr.Blocks(title="Fibo-Edit-RMBG - Background Removal") as demo:
|
|
| 99 |
process_btn = gr.Button("🚀 Process Image", variant="primary")
|
| 100 |
|
| 101 |
with gr.Column(scale=1):
|
| 102 |
-
output_image =
|
| 103 |
-
label="
|
| 104 |
type="pil",
|
| 105 |
height=400
|
| 106 |
)
|
|
@@ -111,7 +112,6 @@ with gr.Blocks(title="Fibo-Edit-RMBG - Background Removal") as demo:
|
|
| 111 |
lines=2
|
| 112 |
)
|
| 113 |
|
| 114 |
-
|
| 115 |
# Connect the button
|
| 116 |
process_btn.click(
|
| 117 |
fn=process_image,
|
|
|
|
| 1 |
import spaces
|
| 2 |
import gradio as gr
|
| 3 |
+
from gradio_imageslider import ImageSlider
|
| 4 |
import torch
|
| 5 |
from diffusers import DiffusionPipeline
|
| 6 |
from PIL import Image
|
|
|
|
| 52 |
# Use the mask as the alpha channel
|
| 53 |
original_rgba.putalpha(mask_gray)
|
| 54 |
|
| 55 |
+
return (original_rgba, image), "✅ Image processed successfully!"
|
| 56 |
|
| 57 |
except Exception as e:
|
| 58 |
return None, f"❌ Error: {str(e)}"
|
|
|
|
| 100 |
process_btn = gr.Button("🚀 Process Image", variant="primary")
|
| 101 |
|
| 102 |
with gr.Column(scale=1):
|
| 103 |
+
output_image = ImageSlider(
|
| 104 |
+
label="Result vs Original",
|
| 105 |
type="pil",
|
| 106 |
height=400
|
| 107 |
)
|
|
|
|
| 112 |
lines=2
|
| 113 |
)
|
| 114 |
|
|
|
|
| 115 |
# Connect the button
|
| 116 |
process_btn.click(
|
| 117 |
fn=process_image,
|