Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,6 +18,12 @@ load_dotenv()
|
|
| 18 |
# Configure Google API
|
| 19 |
genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
# Initialize Gemini models
|
| 22 |
llm_flash_exp = ChatGoogleGenerativeAI(model="gemini-2.0-flash-exp")
|
| 23 |
|
|
@@ -87,6 +93,7 @@ class SmartShoppingAssistant:
|
|
| 87 |
prompt = """Analyze this image and extra products text from the image """
|
| 88 |
|
| 89 |
try:
|
|
|
|
| 90 |
response = model.generate_content([prompt, image])
|
| 91 |
return response.text
|
| 92 |
# This will need OCR if the image contains text.
|
|
|
|
| 18 |
# Configure Google API
|
| 19 |
genai.configure(api_key=os.getenv('GOOGLE_API_KEY'))
|
| 20 |
|
| 21 |
+
def configure_gemini(api_key):
|
| 22 |
+
genai.configure(api_key=api_key)
|
| 23 |
+
return genai.GenerativeModel('gemini-2.0-flash-thinking-exp')
|
| 24 |
+
|
| 25 |
+
model = configure_gemini(os.environ['Gemini'])
|
| 26 |
+
|
| 27 |
# Initialize Gemini models
|
| 28 |
llm_flash_exp = ChatGoogleGenerativeAI(model="gemini-2.0-flash-exp")
|
| 29 |
|
|
|
|
| 93 |
prompt = """Analyze this image and extra products text from the image """
|
| 94 |
|
| 95 |
try:
|
| 96 |
+
|
| 97 |
response = model.generate_content([prompt, image])
|
| 98 |
return response.text
|
| 99 |
# This will need OCR if the image contains text.
|