dindizz commited on
Commit
24747b5
1 Parent(s): 1d8e0f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -7
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 load and display the image
58
  def upload_and_analyze(image):
59
- # Open the image and display
60
- ad_image = Image.open(image)
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