Update handler.py
Browse files- handler.py +2 -1
handler.py
CHANGED
@@ -8,7 +8,7 @@ from serpapi import GoogleSearch
|
|
8 |
from keybert import KeyBERT
|
9 |
from typing import Dict, Any, List
|
10 |
import base64
|
11 |
-
|
12 |
model_id = "vikhyatk/moondream2"
|
13 |
revision = "2024-08-26"
|
14 |
model = AutoModelForCausalLM.from_pretrained(
|
@@ -53,6 +53,7 @@ class ProductSearcher:
|
|
53 |
|
54 |
enc_image = model.encode_image(image)
|
55 |
self.description = model.answer_question(enc_image, prompt, tokenizer)
|
|
|
56 |
|
57 |
def extract_keyphrases(self):
|
58 |
self.keyphrases = self.kw_model.extract_keywords(self.description)
|
|
|
8 |
from keybert import KeyBERT
|
9 |
from typing import Dict, Any, List
|
10 |
import base64
|
11 |
+
import torch
|
12 |
model_id = "vikhyatk/moondream2"
|
13 |
revision = "2024-08-26"
|
14 |
model = AutoModelForCausalLM.from_pretrained(
|
|
|
53 |
|
54 |
enc_image = model.encode_image(image)
|
55 |
self.description = model.answer_question(enc_image, prompt, tokenizer)
|
56 |
+
del enc_image
|
57 |
|
58 |
def extract_keyphrases(self):
|
59 |
self.keyphrases = self.kw_model.extract_keywords(self.description)
|