hwajjala commited on
Commit
1874289
1 Parent(s): 0e6ad50
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -4,7 +4,17 @@ import os
4
  from pytrends.request import TrendReq
5
  from openai import OpenAI
6
 
7
- pytrends = TrendReq(hl="en-US")
 
 
 
 
 
 
 
 
 
 
8
 
9
  kw_list = [""]
10
  client = OpenAI(
@@ -57,7 +67,7 @@ def fetch_clothing_themes_and_generate_banner_2(geo, start_date, end_date):
57
  return theme_suggestion, all_top_queries
58
 
59
 
60
- def greet(city, start_date_dd_mm_yyyy, end_date_dd_mm_yyyy):
61
  chat_completion = client.chat.completions.create(
62
  messages=[
63
  {
@@ -69,7 +79,7 @@ def greet(city, start_date_dd_mm_yyyy, end_date_dd_mm_yyyy):
69
  )
70
  geo = chat_completion.choices[0].message.content.strip()
71
 
72
- timeframe = f"{start_date_dd_mm_yyyy} {end_date_dd_mm_yyyy}"
73
  pytrends.build_payload(kw_list, timeframe=timeframe, geo=geo)
74
  all_top_queries = pytrends.related_queries()
75
  top_queries = all_top_queries[""]["top"]
 
4
  from pytrends.request import TrendReq
5
  from openai import OpenAI
6
 
7
+ pytrends = TrendReq(
8
+ hl="en-US",
9
+ tz=360,
10
+ timeout=(10, 25),
11
+ proxies=[
12
+ "https://34.203.233.13:80",
13
+ ],
14
+ retries=2,
15
+ backoff_factor=0.1,
16
+ requests_args={"verify": False},
17
+ )
18
 
19
  kw_list = [""]
20
  client = OpenAI(
 
67
  return theme_suggestion, all_top_queries
68
 
69
 
70
+ def greet(city, start_date_yyyy_mm_dd, end_date_yyyy_mm_dd):
71
  chat_completion = client.chat.completions.create(
72
  messages=[
73
  {
 
79
  )
80
  geo = chat_completion.choices[0].message.content.strip()
81
 
82
+ timeframe = f"{start_date_yyyy_mm_dd} {end_date_yyyy_mm_dd}"
83
  pytrends.build_payload(kw_list, timeframe=timeframe, geo=geo)
84
  all_top_queries = pytrends.related_queries()
85
  top_queries = all_top_queries[""]["top"]