Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import torch
|
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
# Load the model
|
| 7 |
-
model = AutoModelForImageSegmentation.from_pretrained("
|
| 8 |
|
| 9 |
# Load the tokenizer (if needed)
|
| 10 |
tokenizer = AutoTokenizer.from_pretrained("path/to/tokenizer")
|
|
@@ -16,7 +16,7 @@ def predict_segmentation(image):
|
|
| 16 |
# Perform inference
|
| 17 |
output = model(image)
|
| 18 |
# Process the output as needed (e.g., post-processing for segmentation masks)
|
| 19 |
-
|
| 20 |
segmentation_mask = output.logits.argmax(dim=1).squeeze().detach().numpy()
|
| 21 |
return segmentation_mask
|
| 22 |
|
|
|
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
# Load the model
|
| 7 |
+
model = AutoModelForImageSegmentation.from_pretrained("./gelan-c-seg.pt")
|
| 8 |
|
| 9 |
# Load the tokenizer (if needed)
|
| 10 |
tokenizer = AutoTokenizer.from_pretrained("path/to/tokenizer")
|
|
|
|
| 16 |
# Perform inference
|
| 17 |
output = model(image)
|
| 18 |
# Process the output as needed (e.g., post-processing for segmentation masks)
|
| 19 |
+
|
| 20 |
segmentation_mask = output.logits.argmax(dim=1).squeeze().detach().numpy()
|
| 21 |
return segmentation_mask
|
| 22 |
|