Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -13,7 +13,7 @@ openai.api_key = os.getenv("OPENAI_API_KEY").strip()
|
|
13 |
|
14 |
# Function to analyze the ad image (text analysis with GPT-4)
|
15 |
def analyze_ad(image):
|
16 |
-
# Convert the image to bytes (you can
|
17 |
image_bytes = io.BytesIO()
|
18 |
image.save(image_bytes, format='PNG')
|
19 |
image_bytes = image_bytes.getvalue()
|
@@ -32,7 +32,7 @@ def analyze_ad(image):
|
|
32 |
"""
|
33 |
|
34 |
# Send the prompt to GPT-4-turbo for analysis
|
35 |
-
response = openai.
|
36 |
model="gpt-4-turbo",
|
37 |
messages=[
|
38 |
{"role": "system", "content": "You are a marketing expert analyzing an advertisement."},
|
|
|
13 |
|
14 |
# Function to analyze the ad image (text analysis with GPT-4)
|
15 |
def analyze_ad(image):
|
16 |
+
# Convert the image to bytes (you can keep this for future multimodal capabilities)
|
17 |
image_bytes = io.BytesIO()
|
18 |
image.save(image_bytes, format='PNG')
|
19 |
image_bytes = image_bytes.getvalue()
|
|
|
32 |
"""
|
33 |
|
34 |
# Send the prompt to GPT-4-turbo for analysis
|
35 |
+
response = openai.chat_completions.create(
|
36 |
model="gpt-4-turbo",
|
37 |
messages=[
|
38 |
{"role": "system", "content": "You are a marketing expert analyzing an advertisement."},
|