Spaces:
Running on Zero
Running on Zero
Upload folder using huggingface_hub
Browse files- app.py +2 -0
- requirements.txt +1 -0
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import torch
|
|
| 3 |
from diffusers import DiffusionPipeline
|
| 4 |
from PIL import Image
|
| 5 |
import os
|
|
|
|
| 6 |
|
| 7 |
# Load the model
|
| 8 |
print("Loading RMBG-3.0 model...")
|
|
@@ -17,6 +18,7 @@ device = "cuda" if torch.cuda.is_available() else "cpu"
|
|
| 17 |
pipe.to(device)
|
| 18 |
print(f"Model loaded on {device}")
|
| 19 |
|
|
|
|
| 20 |
def process_image(image, instruction, num_steps=50, guidance_scale=5.0):
|
| 21 |
"""
|
| 22 |
Process an image with RMBG-3.0
|
|
|
|
| 3 |
from diffusers import DiffusionPipeline
|
| 4 |
from PIL import Image
|
| 5 |
import os
|
| 6 |
+
import spaces
|
| 7 |
|
| 8 |
# Load the model
|
| 9 |
print("Loading RMBG-3.0 model...")
|
|
|
|
| 18 |
pipe.to(device)
|
| 19 |
print(f"Model loaded on {device}")
|
| 20 |
|
| 21 |
+
@spaces.GPU
|
| 22 |
def process_image(image, instruction, num_steps=50, guidance_scale=5.0):
|
| 23 |
"""
|
| 24 |
Process an image with RMBG-3.0
|
requirements.txt
CHANGED
|
@@ -6,3 +6,4 @@ safetensors>=0.4.0
|
|
| 6 |
pillow>=10.0.0
|
| 7 |
huggingface_hub>=0.34.0
|
| 8 |
gradio>=5.8.0
|
|
|
|
|
|
| 6 |
pillow>=10.0.0
|
| 7 |
huggingface_hub>=0.34.0
|
| 8 |
gradio>=5.8.0
|
| 9 |
+
spaces
|