Update model.py
Browse files
model.py
CHANGED
@@ -147,16 +147,16 @@ class MoondreamModel(nn.Module):
|
|
147 |
|
148 |
return tokenizer.decode(generated, skip_special_tokens=True)
|
149 |
|
150 |
-
# Example usage:
|
151 |
|
152 |
-
# Load the model and tokenizer
|
153 |
-
model = MoondreamModel.load_model()
|
154 |
-
tokenizer = MoondreamModel.load_tokenizer()
|
155 |
|
156 |
-
# Load and preprocess an image (assuming image is a PIL Image)
|
157 |
-
image = Image.open("path_to_image.jpg")
|
158 |
-
preprocessed_image = MoondreamModel.preprocess_image(image)
|
159 |
|
160 |
-
# Generate a caption for the image
|
161 |
-
caption = MoondreamModel.generate_caption(model, preprocessed_image, tokenizer)
|
162 |
-
print("Generated Caption:", caption)
|
|
|
147 |
|
148 |
return tokenizer.decode(generated, skip_special_tokens=True)
|
149 |
|
150 |
+
# # Example usage:
|
151 |
|
152 |
+
# # Load the model and tokenizer
|
153 |
+
# model = MoondreamModel.load_model()
|
154 |
+
# tokenizer = MoondreamModel.load_tokenizer()
|
155 |
|
156 |
+
# # Load and preprocess an image (assuming image is a PIL Image)
|
157 |
+
# image = Image.open("path_to_image.jpg")
|
158 |
+
# preprocessed_image = MoondreamModel.preprocess_image(image)
|
159 |
|
160 |
+
# # Generate a caption for the image
|
161 |
+
# caption = MoondreamModel.generate_caption(model, preprocessed_image, tokenizer)
|
162 |
+
# print("Generated Caption:", caption)
|