Spaces:
Sleeping
Sleeping
Commit
·
98e61eb
1
Parent(s):
d3f4c7b
newer
Browse files
app.py
CHANGED
|
@@ -33,7 +33,14 @@ def product_identification_response(image_path=r"C:\Users\JoeJo\Downloads\XyAaqB
|
|
| 33 |
|
| 34 |
# Load your image
|
| 35 |
clean_path = image_path.strip('"')
|
| 36 |
-
image = Image.open(clean_path)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
# Ask Gemini
|
| 39 |
response = model.generate_content(
|
|
|
|
| 33 |
|
| 34 |
# Load your image
|
| 35 |
clean_path = image_path.strip('"')
|
| 36 |
+
#image = Image.open(clean_path)
|
| 37 |
+
|
| 38 |
+
if clean_path.startswith("http"):
|
| 39 |
+
response = requests.get(clean_path)
|
| 40 |
+
response.raise_for_status() # Throw error if download fails
|
| 41 |
+
image = Image.open(BytesIO(response.content))
|
| 42 |
+
else:
|
| 43 |
+
image = Image.open(clean_path)
|
| 44 |
|
| 45 |
# Ask Gemini
|
| 46 |
response = model.generate_content(
|