Spaces:
Running on Zero
Running on Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,9 +6,9 @@ from PIL import Image
|
|
| 6 |
import os
|
| 7 |
|
| 8 |
# Load the model
|
| 9 |
-
print("Loading
|
| 10 |
pipe = DiffusionPipeline.from_pretrained(
|
| 11 |
-
"briaai/
|
| 12 |
torch_dtype=torch.bfloat16,
|
| 13 |
trust_remote_code=True
|
| 14 |
)
|
|
@@ -19,9 +19,9 @@ pipe.to(device)
|
|
| 19 |
print(f"Model loaded on {device}")
|
| 20 |
|
| 21 |
@spaces.GPU
|
| 22 |
-
def process_image(image, num_steps=
|
| 23 |
"""
|
| 24 |
-
Process an image with
|
| 25 |
"""
|
| 26 |
if image is None:
|
| 27 |
return None, "Please upload an image"
|
|
@@ -57,11 +57,11 @@ def process_image(image, num_steps=50, guidance_scale=5.0):
|
|
| 57 |
return None, f"❌ Error: {str(e)}"
|
| 58 |
|
| 59 |
# Create Gradio interface
|
| 60 |
-
with gr.Blocks(title="
|
| 61 |
gr.Markdown("""
|
| 62 |
-
#
|
| 63 |
|
| 64 |
-
Powered by [Bria AI's
|
| 65 |
|
| 66 |
This model performs background removal on any image
|
| 67 |
|
|
@@ -83,7 +83,7 @@ with gr.Blocks(title="RMBG-3.0 - Background Removal") as demo:
|
|
| 83 |
num_steps = gr.Slider(
|
| 84 |
minimum=1,
|
| 85 |
maximum=50,
|
| 86 |
-
value=
|
| 87 |
step=1,
|
| 88 |
label="Number of Steps"
|
| 89 |
)
|
|
@@ -91,7 +91,7 @@ with gr.Blocks(title="RMBG-3.0 - Background Removal") as demo:
|
|
| 91 |
guidance_scale = gr.Slider(
|
| 92 |
minimum=1.0,
|
| 93 |
maximum=15.0,
|
| 94 |
-
value=
|
| 95 |
step=0.5,
|
| 96 |
label="Guidance Scale"
|
| 97 |
)
|
|
@@ -121,12 +121,12 @@ with gr.Blocks(title="RMBG-3.0 - Background Removal") as demo:
|
|
| 121 |
|
| 122 |
gr.Markdown("""
|
| 123 |
---
|
| 124 |
-
### About
|
| 125 |
|
| 126 |
-
|
| 127 |
that uses structured prompts for precise, deterministic editing.
|
| 128 |
|
| 129 |
-
- **Model**: [briaai/
|
| 130 |
- **Architecture**: Based on FIBO with 8B parameters
|
| 131 |
- **License**: Non-commercial use ([CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/))
|
| 132 |
|
|
|
|
| 6 |
import os
|
| 7 |
|
| 8 |
# Load the model
|
| 9 |
+
print("Loading Fibo-Edit-RMBG model...")
|
| 10 |
pipe = DiffusionPipeline.from_pretrained(
|
| 11 |
+
"briaai/Fibo-Edit-RMBG",
|
| 12 |
torch_dtype=torch.bfloat16,
|
| 13 |
trust_remote_code=True
|
| 14 |
)
|
|
|
|
| 19 |
print(f"Model loaded on {device}")
|
| 20 |
|
| 21 |
@spaces.GPU
|
| 22 |
+
def process_image(image, num_steps=10, guidance_scale=1.0):
|
| 23 |
"""
|
| 24 |
+
Process an image with Fibo-Edit-RMBG
|
| 25 |
"""
|
| 26 |
if image is None:
|
| 27 |
return None, "Please upload an image"
|
|
|
|
| 57 |
return None, f"❌ Error: {str(e)}"
|
| 58 |
|
| 59 |
# Create Gradio interface
|
| 60 |
+
with gr.Blocks(title="Fibo-Edit-RMBG - Background Removal") as demo:
|
| 61 |
gr.Markdown("""
|
| 62 |
+
# Fibo-Edit-RMBG - Background Removal
|
| 63 |
|
| 64 |
+
Powered by [Bria AI's Fibo-Edit-RMBG model](https://huggingface.co/briaai/Fibo-Edit-RMBG)
|
| 65 |
|
| 66 |
This model performs background removal on any image
|
| 67 |
|
|
|
|
| 83 |
num_steps = gr.Slider(
|
| 84 |
minimum=1,
|
| 85 |
maximum=50,
|
| 86 |
+
value=10,
|
| 87 |
step=1,
|
| 88 |
label="Number of Steps"
|
| 89 |
)
|
|
|
|
| 91 |
guidance_scale = gr.Slider(
|
| 92 |
minimum=1.0,
|
| 93 |
maximum=15.0,
|
| 94 |
+
value=1.0,
|
| 95 |
step=0.5,
|
| 96 |
label="Guidance Scale"
|
| 97 |
)
|
|
|
|
| 121 |
|
| 122 |
gr.Markdown("""
|
| 123 |
---
|
| 124 |
+
### About Fibo-Edit-RMBG
|
| 125 |
|
| 126 |
+
Fibo-Edit-RMBG is built on [Fibo-Edit](https://huggingface.co/briaai/Fibo-Edit), an 8B parameter image editing model
|
| 127 |
that uses structured prompts for precise, deterministic editing.
|
| 128 |
|
| 129 |
+
- **Model**: [briaai/Fibo-Edit-RMBG](https://huggingface.co/briaai/Fibo-Edit-RMBG)
|
| 130 |
- **Architecture**: Based on FIBO with 8B parameters
|
| 131 |
- **License**: Non-commercial use ([CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/))
|
| 132 |
|