MohanadAfiffy commited on
Commit
eabc080
·
verified ·
1 Parent(s): 7a199ac

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +1 -6
  2. clients.py +13 -11
app.py CHANGED
@@ -78,7 +78,6 @@ st.markdown("""
78
  </ul>
79
  <a href="https://docs.google.com/spreadsheets/d/1YFuE3ZC31QIGy0YLNK_2v89y0NbektheXXI1QDNA3Ng/edit?usp=sharing" target="_blank">Check the template from here</a>
80
  <br>
81
-
82
  """,unsafe_allow_html=True)
83
  st.markdown("""
84
  <br>
@@ -93,7 +92,6 @@ st.markdown("-----------------------------------------------------")
93
  st.markdown("""
94
  <h2 style='color: navy;'>Sales Core team - Apollo -</h2>
95
  <h3 style='color: darkslategray;'>Data Processing Functions</h3>
96
-
97
  <h4 style='color: darkcyan;'>Company-Specific Client Function</h4>
98
  <p style='color: slategray;'>Upload a CSV with company names and websites.</p>
99
  <ul>
@@ -110,7 +108,6 @@ st.markdown("""
110
  </ul>
111
  </li>
112
  </ul>
113
-
114
  <h4 style='color: darkcyan;'>User-Specific Client Function</h4>
115
  <p style='color: slategray;'>Upload a CSV with personal and company information.</p>
116
  <ul>
@@ -127,7 +124,6 @@ st.markdown("""
127
  </ul>
128
  </li>
129
  </ul>
130
-
131
  <h4 style='color: darkcyan;'>Both Features Function</h4>
132
  <p style='color: slategray;'>Combine user and company-specific data processing.</p>
133
  <ul>
@@ -164,5 +160,4 @@ st.markdown(
164
  <img src="{logo_url}" class="logo">
165
  """,
166
  unsafe_allow_html=True,
167
- )
168
-
 
78
  </ul>
79
  <a href="https://docs.google.com/spreadsheets/d/1YFuE3ZC31QIGy0YLNK_2v89y0NbektheXXI1QDNA3Ng/edit?usp=sharing" target="_blank">Check the template from here</a>
80
  <br>
 
81
  """,unsafe_allow_html=True)
82
  st.markdown("""
83
  <br>
 
92
  st.markdown("""
93
  <h2 style='color: navy;'>Sales Core team - Apollo -</h2>
94
  <h3 style='color: darkslategray;'>Data Processing Functions</h3>
 
95
  <h4 style='color: darkcyan;'>Company-Specific Client Function</h4>
96
  <p style='color: slategray;'>Upload a CSV with company names and websites.</p>
97
  <ul>
 
108
  </ul>
109
  </li>
110
  </ul>
 
111
  <h4 style='color: darkcyan;'>User-Specific Client Function</h4>
112
  <p style='color: slategray;'>Upload a CSV with personal and company information.</p>
113
  <ul>
 
124
  </ul>
125
  </li>
126
  </ul>
 
127
  <h4 style='color: darkcyan;'>Both Features Function</h4>
128
  <p style='color: slategray;'>Combine user and company-specific data processing.</p>
129
  <ul>
 
160
  <img src="{logo_url}" class="logo">
161
  """,
162
  unsafe_allow_html=True,
163
+ )
 
clients.py CHANGED
@@ -2,7 +2,6 @@
2
  # -*- coding: utf-8 -*-
3
  """
4
  Created on Mon Jan 1 11:20:18 2024
5
-
6
  @author: mohanadafiffy
7
  """
8
  import os
@@ -10,7 +9,8 @@ import streamlit as st
10
  import pandas as pd
11
  import requests
12
  import os
13
-
 
14
  host=os.getenv("backend")
15
 
16
  CompanyBackendService=host+'/receive_companies/'
@@ -25,7 +25,6 @@ def add_https_to_urls(df, column_name):
25
  Adds 'https://' to URLs in the specified column of a DataFrame if they don't already start with a valid protocol.
26
  Corrects URLs starting with 'http:/' or 'https:/'.
27
  Handles missing values, trims whitespace, and is case-insensitive.
28
-
29
  Parameters:
30
  df (pandas.DataFrame): The DataFrame containing the URLs.
31
  column_name (str): The name of the column with URLs.
@@ -75,7 +74,12 @@ def CompanySpecificClient(email_receiver):
75
  company_column= st.selectbox("Select the column for Company Name for Emails:", all_columns,key="CompanyName")
76
  else:
77
  company_column = 'Company Name for Emails'
78
-
 
 
 
 
 
79
  if opt_out_scraping:
80
  if 'Company Description' not in df.columns:
81
  all_columns = df.columns.tolist()
@@ -89,8 +93,6 @@ def CompanySpecificClient(email_receiver):
89
  except Exception as E :
90
  st.error("An error occured while processing the file")
91
 
92
- # Fetch the filtered data
93
-
94
 
95
 
96
  prompt_notes= st.text_input("If applicable please mention the network name",key="CompanyPromptNotes")
@@ -108,14 +110,14 @@ def CompanySpecificClient(email_receiver):
108
  df = input_data_companies
109
  if not opt_out_scraping:
110
  df[website_column] = df[website_column].astype(str)
111
- df=df[[website_column,company_column]]
112
- df.columns = ["Website","Company Name for Emails"]
113
  df = df.drop_duplicates(subset="Website", keep='first')
114
  df = df.dropna().loc[~(df == '').all(axis=1)]
115
  else:
116
  df[website_column] = df[website_column].astype(str)
117
- df=df[[website_column,company_column,"scraped_content"]]
118
- df.columns = ["Website","Company Name for Emails","scraped_content"]
119
  df = df.drop_duplicates(subset="Website", keep='first')
120
  df = df.dropna().loc[~(df == '').all(axis=1)]
121
 
@@ -500,4 +502,4 @@ def BH_industry(email_receiver,calendly_link,sender_name):
500
  st.info(f"We're processing your request. You can close the app now. An email will be sent to {email_receiver} once the process is finished.")
501
  else:
502
  st.error("Data transmission failed. Please verify that your file contains the labels 'Company Website' and 'Company Name'. Additionally, ensure that your file is valid and contains records and try again , if the problem persists please contact us at [email protected]")
503
- return None
 
2
  # -*- coding: utf-8 -*-
3
  """
4
  Created on Mon Jan 1 11:20:18 2024
 
5
  @author: mohanadafiffy
6
  """
7
  import os
 
9
  import pandas as pd
10
  import requests
11
  import os
12
+ from dotenv import load_dotenv
13
+ load_dotenv()
14
  host=os.getenv("backend")
15
 
16
  CompanyBackendService=host+'/receive_companies/'
 
25
  Adds 'https://' to URLs in the specified column of a DataFrame if they don't already start with a valid protocol.
26
  Corrects URLs starting with 'http:/' or 'https:/'.
27
  Handles missing values, trims whitespace, and is case-insensitive.
 
28
  Parameters:
29
  df (pandas.DataFrame): The DataFrame containing the URLs.
30
  column_name (str): The name of the column with URLs.
 
74
  company_column= st.selectbox("Select the column for Company Name for Emails:", all_columns,key="CompanyName")
75
  else:
76
  company_column = 'Company Name for Emails'
77
+
78
+ if 'Apollo description' not in df.columns:
79
+ all_columns = df.columns.tolist()
80
+ Apollo_description= st.selectbox("Select the column for Apollo description:", all_columns,key="ApolloDescription")
81
+ else:
82
+ Apollo_description = 'Apollo description'
83
  if opt_out_scraping:
84
  if 'Company Description' not in df.columns:
85
  all_columns = df.columns.tolist()
 
93
  except Exception as E :
94
  st.error("An error occured while processing the file")
95
 
 
 
96
 
97
 
98
  prompt_notes= st.text_input("If applicable please mention the network name",key="CompanyPromptNotes")
 
110
  df = input_data_companies
111
  if not opt_out_scraping:
112
  df[website_column] = df[website_column].astype(str)
113
+ df=df[[website_column,company_column,Apollo_description]]
114
+ df.columns = ["Website","Company Name for Emails","Apollo description"]
115
  df = df.drop_duplicates(subset="Website", keep='first')
116
  df = df.dropna().loc[~(df == '').all(axis=1)]
117
  else:
118
  df[website_column] = df[website_column].astype(str)
119
+ df=df[[website_column,company_column,Apollo_description,"scraped_content"]]
120
+ df.columns = ["Website","Company Name for Emails","Apollo description","scraped_content"]
121
  df = df.drop_duplicates(subset="Website", keep='first')
122
  df = df.dropna().loc[~(df == '').all(axis=1)]
123
 
 
502
  st.info(f"We're processing your request. You can close the app now. An email will be sent to {email_receiver} once the process is finished.")
503
  else:
504
  st.error("Data transmission failed. Please verify that your file contains the labels 'Company Website' and 'Company Name'. Additionally, ensure that your file is valid and contains records and try again , if the problem persists please contact us at [email protected]")
505
+ return None