Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ openai.api_key = os.getenv("OPENAI_API_KEY")
|
|
13 |
|
14 |
# Function to analyze the ad and generate marketing personas + scoring
|
15 |
def analyze_ad(image):
|
16 |
-
# Convert the image to bytes
|
17 |
image_bytes = io.BytesIO()
|
18 |
image.save(image_bytes, format='PNG')
|
19 |
image_bytes = image_bytes.getvalue()
|
@@ -54,13 +54,10 @@ def analyze_ad(image):
|
|
54 |
# Return the result for display
|
55 |
return result
|
56 |
|
57 |
-
# Function to
|
58 |
def upload_and_analyze(image):
|
59 |
-
#
|
60 |
-
|
61 |
-
|
62 |
-
# Analyze the ad
|
63 |
-
result = analyze_ad(ad_image)
|
64 |
|
65 |
return result
|
66 |
|
|
|
13 |
|
14 |
# Function to analyze the ad and generate marketing personas + scoring
|
15 |
def analyze_ad(image):
|
16 |
+
# Convert the PIL image to bytes
|
17 |
image_bytes = io.BytesIO()
|
18 |
image.save(image_bytes, format='PNG')
|
19 |
image_bytes = image_bytes.getvalue()
|
|
|
54 |
# Return the result for display
|
55 |
return result
|
56 |
|
57 |
+
# Function to process the image and run the analysis
|
58 |
def upload_and_analyze(image):
|
59 |
+
# No need to open the image, as it is already a PIL image
|
60 |
+
result = analyze_ad(image)
|
|
|
|
|
|
|
61 |
|
62 |
return result
|
63 |
|