Update app.py
Browse files
app.py
CHANGED
@@ -16,24 +16,6 @@ model = Qwen2VLForConditionalGeneration.from_pretrained(
|
|
16 |
)
|
17 |
processor = AutoProcessor.from_pretrained("./Qwen2-VL-7B-Instruct")
|
18 |
|
19 |
-
def array_to_image_path(image_array):
|
20 |
-
if image_array is None:
|
21 |
-
raise ValueError("No image provided. Please upload an image before submitting.")
|
22 |
-
# Convert numpy array to PIL Image
|
23 |
-
img = Image.fromarray(np.uint8(image_array))
|
24 |
-
|
25 |
-
# Generate a unique filename using timestamp
|
26 |
-
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
27 |
-
filename = f"image_{timestamp}.png"
|
28 |
-
|
29 |
-
# Save the image
|
30 |
-
img.save(filename)
|
31 |
-
|
32 |
-
# Get the full path of the saved image
|
33 |
-
full_path = os.path.abspath(filename)
|
34 |
-
|
35 |
-
return full_path
|
36 |
-
|
37 |
def generate_embeddings(text):
|
38 |
model = SentenceTransformer('./all-MiniLM-L6-v2')
|
39 |
embeddings = model.encode(sentences)
|
|
|
16 |
)
|
17 |
processor = AutoProcessor.from_pretrained("./Qwen2-VL-7B-Instruct")
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
def generate_embeddings(text):
|
20 |
model = SentenceTransformer('./all-MiniLM-L6-v2')
|
21 |
embeddings = model.encode(sentences)
|