Feature Extraction
Transformers
PyTorch
Safetensors
English
magi
Manga
Object Detection
OCR
Clustering
Diarisation
custom_code
Instructions to use ragavsachdeva/magi with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use ragavsachdeva/magi with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="ragavsachdeva/magi", trust_remote_code=True)# Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("ragavsachdeva/magi", trust_remote_code=True, dtype="auto") - Notebooks
- Google Colab
- Kaggle
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -90,7 +90,11 @@ class UnionFind:
|
|
| 90 |
return labels
|
| 91 |
|
| 92 |
def visualise_single_image_prediction(image_as_np_array, predictions, filename):
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
subplot.imshow(image_as_np_array)
|
| 95 |
plot_bboxes(subplot, predictions["panels"], color="green")
|
| 96 |
plot_bboxes(subplot, predictions["texts"], color="red", add_index=True)
|
|
|
|
| 90 |
return labels
|
| 91 |
|
| 92 |
def visualise_single_image_prediction(image_as_np_array, predictions, filename):
|
| 93 |
+
h, w = image_as_np_array.shape[:2]
|
| 94 |
+
if h > w:
|
| 95 |
+
figure, subplot = plt.subplots(1, 1, figsize=(10, 10 * h / w))
|
| 96 |
+
else:
|
| 97 |
+
figure, subplot = plt.subplots(1, 1, figsize=(10 * w / h, 10))
|
| 98 |
subplot.imshow(image_as_np_array)
|
| 99 |
plot_bboxes(subplot, predictions["panels"], color="green")
|
| 100 |
plot_bboxes(subplot, predictions["texts"], color="red", add_index=True)
|