zzmez commited on
Commit
fd392e2
·
1 Parent(s): ec165f9

feat: add domain as a filter for top list

Browse files
Files changed (2) hide show
  1. app.py +2 -1
  2. utils/gradio_utils.py +2 -2
app.py CHANGED
@@ -15,7 +15,8 @@ PASS = os.getenv("PASSWORD")
15
  list_iface = gr.Interface(fn=compute_offer,
16
  inputs=[gr.File(label="Upload CSV", type="file"),
17
  gr.Slider(1, 365, value=30, step=1, label="Days", info="Number of days to look back"),
18
- gr.Slider(5000, 100000, value=15000, step=1, label="Minimum Sent", info="Minimum number of emails sent")
 
19
  ],
20
  outputs="dataframe")
21
 
 
15
  list_iface = gr.Interface(fn=compute_offer,
16
  inputs=[gr.File(label="Upload CSV", type="file"),
17
  gr.Slider(1, 365, value=30, step=1, label="Days", info="Number of days to look back"),
18
+ gr.Slider(5000, 100000, value=15000, step=1, label="Minimum Sent", info="Minimum number of emails sent"),
19
+ gr.Dropdown(["Comcast", "Yahoo", "Hotmail", "Aol"], value="Comcast", label="Domain")
20
  ],
21
  outputs="dataframe")
22
 
utils/gradio_utils.py CHANGED
@@ -231,7 +231,7 @@ def generate_ips_per_subclass(ip_subclasses: str, num_of_ips: int) -> str:
231
 
232
 
233
  ### GENERATE TOP LISTS ###
234
- def compute_offer(csv_file, days_lookback, min_sent):
235
  # cmp_list = ['MSP', 'HOM', 'NTU', 'HCK', 'DDS', 'MNP', 'PSC', 'DTL', 'GVS', 'ANP', 'WDR', 'BSG'] #1
236
 
237
  #raw_df = pd.read_csv('tools/data/30.08.2023.gabriel.sabau.campanii.csv', parse_dates=['Data'])
@@ -244,7 +244,7 @@ def compute_offer(csv_file, days_lookback, min_sent):
244
  # comcast_df = raw_df[raw_df['Nume'].str.contains('|'.join(cmp_list))] #1
245
  # comcast_df = comcast_df[comcast_df['Domeniu'] == 'Comcast'] #2
246
  exclude_list = comcast_df[(comcast_df['Data'] > (pd.Timestamp('now') - pd.Timedelta(days=days_lookback))) \
247
- & (comcast_df['Domeniu'] == 'Comcast')]['Oferta'].unique()
248
  comcast_df = comcast_df[~comcast_df['Oferta'].isin(exclude_list)]
249
 
250
  comcast_df = comcast_df[comcast_df['Send'] > int(min_sent)]
 
231
 
232
 
233
  ### GENERATE TOP LISTS ###
234
+ def compute_offer(csv_file, days_lookback, min_sent, domain):
235
  # cmp_list = ['MSP', 'HOM', 'NTU', 'HCK', 'DDS', 'MNP', 'PSC', 'DTL', 'GVS', 'ANP', 'WDR', 'BSG'] #1
236
 
237
  #raw_df = pd.read_csv('tools/data/30.08.2023.gabriel.sabau.campanii.csv', parse_dates=['Data'])
 
244
  # comcast_df = raw_df[raw_df['Nume'].str.contains('|'.join(cmp_list))] #1
245
  # comcast_df = comcast_df[comcast_df['Domeniu'] == 'Comcast'] #2
246
  exclude_list = comcast_df[(comcast_df['Data'] > (pd.Timestamp('now') - pd.Timedelta(days=days_lookback))) \
247
+ & (comcast_df['Domeniu'] == domain)]['Oferta'].unique()
248
  comcast_df = comcast_df[~comcast_df['Oferta'].isin(exclude_list)]
249
 
250
  comcast_df = comcast_df[comcast_df['Send'] > int(min_sent)]