Spaces:
Runtime error
Runtime error
jonathanjordan21
commited on
Commit
·
1d9a0f0
1
Parent(s):
d0d4d9c
Fix Error : Add integration of gpu device
Browse files
app.py
CHANGED
@@ -6,13 +6,17 @@ import torch
|
|
6 |
|
7 |
from transformers import DonutProcessor, VisionEncoderDecoderModel
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
10 |
def predict(inp):
|
11 |
-
# Load processor
|
12 |
-
processor = DonutProcessor.from_pretrained("jonathanjordan21/donut_fine_tuning_food_composition_id")
|
13 |
-
|
14 |
-
# Load model
|
15 |
-
model = VisionEncoderDecoderModel.from_pretrained("jonathanjordan21/donut_fine_tuning_food_composition_id")
|
16 |
|
17 |
# Define Json Parser
|
18 |
def get_komposisi(image_path, image=None):
|
|
|
6 |
|
7 |
from transformers import DonutProcessor, VisionEncoderDecoderModel
|
8 |
|
9 |
+
# Check GPU
|
10 |
+
device = "cuda" if torch.cuda.is_available() else "cpu"
|
11 |
+
|
12 |
+
# Load processor
|
13 |
+
processor = DonutProcessor.from_pretrained("jonathanjordan21/donut_fine_tuning_food_composition_id")
|
14 |
+
|
15 |
+
# Load model
|
16 |
+
model = VisionEncoderDecoderModel.from_pretrained("jonathanjordan21/donut_fine_tuning_food_composition_id")
|
17 |
+
|
18 |
|
19 |
def predict(inp):
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
# Define Json Parser
|
22 |
def get_komposisi(image_path, image=None):
|