Spaces:
Build error
Build error
Commit
·
1dcfbb3
1
Parent(s):
f6f8006
add: del temp image file
Browse files
src/components/title_des_gen.py
CHANGED
|
@@ -3,6 +3,8 @@ project @ NTO-TCP-HF
|
|
| 3 |
created @ 2024-10-29
|
| 4 |
author @ github.com/ishworrsubedii
|
| 5 |
"""
|
|
|
|
|
|
|
| 6 |
import google.generativeai as genai
|
| 7 |
from tempfile import NamedTemporaryFile
|
| 8 |
|
|
@@ -38,6 +40,7 @@ class NecklaceProductListing:
|
|
| 38 |
def gen_title_desc(self, image):
|
| 39 |
image_path = self.save_image_tempfile(image)
|
| 40 |
sample_file = self.image_upload(image_path)
|
|
|
|
| 41 |
|
| 42 |
response = self.model.generate_content([sample_file, self.prompt])
|
| 43 |
return response.text
|
|
|
|
| 3 |
created @ 2024-10-29
|
| 4 |
author @ github.com/ishworrsubedii
|
| 5 |
"""
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
import google.generativeai as genai
|
| 9 |
from tempfile import NamedTemporaryFile
|
| 10 |
|
|
|
|
| 40 |
def gen_title_desc(self, image):
|
| 41 |
image_path = self.save_image_tempfile(image)
|
| 42 |
sample_file = self.image_upload(image_path)
|
| 43 |
+
os.remove(image_path)
|
| 44 |
|
| 45 |
response = self.model.generate_content([sample_file, self.prompt])
|
| 46 |
return response.text
|