Spaces:
Build error
Build error
Ronio Jerico Roque commited on
Commit ·
3f96c5d
1
Parent(s): e3b6ad1
Refactor SeoOffPageAnalyst process method to remove website audience dependency and update session state handling in WebsiteAudienceAcquisition
Browse files
classes/Off_Page.py
CHANGED
|
@@ -50,7 +50,7 @@ class SeoOffPageAnalyst:
|
|
| 50 |
def process(self):
|
| 51 |
start_time = time.time()
|
| 52 |
session = st.session_state['analyze']
|
| 53 |
-
if (self.uploaded_files
|
| 54 |
combined_text = ""
|
| 55 |
website_audience = ""
|
| 56 |
with st.spinner('Uploading Off Page...', show_time=True):
|
|
@@ -77,7 +77,7 @@ class SeoOffPageAnalyst:
|
|
| 77 |
combined_text += f"Referring Domain: {unique_domains}"
|
| 78 |
#st.info("Backlinks - SEMRush Uploaded Successfuly", icon="ℹ️")
|
| 79 |
except KeyError:
|
| 80 |
-
|
| 81 |
pass
|
| 82 |
except UnboundLocalError:
|
| 83 |
pass
|
|
@@ -85,7 +85,7 @@ class SeoOffPageAnalyst:
|
|
| 85 |
pass
|
| 86 |
except KeyError:
|
| 87 |
pass
|
| 88 |
-
|
| 89 |
try:
|
| 90 |
# Check if upload_website_audience exists in session state and is a dictionary
|
| 91 |
if 'upload_website_audience' in st.session_state and isinstance(st.session_state['upload_website_audience'], dict):
|
|
@@ -107,7 +107,7 @@ class SeoOffPageAnalyst:
|
|
| 107 |
except Exception as e:
|
| 108 |
st.error(f"Error processing data: {str(e)}")
|
| 109 |
|
| 110 |
-
|
| 111 |
# OUTPUT FOR SEO ANALYST
|
| 112 |
|
| 113 |
#result = self.request_model(payload_txt, headers)
|
|
@@ -134,13 +134,13 @@ class SeoOffPageAnalyst:
|
|
| 134 |
def row1(self):
|
| 135 |
#st.write(self.data_src)
|
| 136 |
self.uploaded_files = st.file_uploader('Backlinks - SEMRush', type='csv', accept_multiple_files=True, key="seo_off")
|
| 137 |
-
self.website_audience = st.file_uploader('Website Audience Acquisition - GA4', type='csv', accept_multiple_files=True, key="website_audiences")
|
| 138 |
#self.website_audience = st.text_input("Website Audience Acquisition:", placeholder='Enter Website Audience Acquisition')
|
| 139 |
|
| 140 |
if self.uploaded_files:
|
| 141 |
upload.multiple_upload_file(self.uploaded_files)
|
| 142 |
-
if self.website_audience:
|
| 143 |
-
|
| 144 |
|
| 145 |
#st.write("") # FOR THE HIDE BUTTON
|
| 146 |
#st.write("") # FOR THE HIDE BUTTON
|
|
|
|
| 50 |
def process(self):
|
| 51 |
start_time = time.time()
|
| 52 |
session = st.session_state['analyze']
|
| 53 |
+
if (self.uploaded_files) and session == 'clicked':
|
| 54 |
combined_text = ""
|
| 55 |
website_audience = ""
|
| 56 |
with st.spinner('Uploading Off Page...', show_time=True):
|
|
|
|
| 77 |
combined_text += f"Referring Domain: {unique_domains}"
|
| 78 |
#st.info("Backlinks - SEMRush Uploaded Successfuly", icon="ℹ️")
|
| 79 |
except KeyError:
|
| 80 |
+
st.info("Incorrect CSV format. Please upload a valid CSV file.")
|
| 81 |
pass
|
| 82 |
except UnboundLocalError:
|
| 83 |
pass
|
|
|
|
| 85 |
pass
|
| 86 |
except KeyError:
|
| 87 |
pass
|
| 88 |
+
'''
|
| 89 |
try:
|
| 90 |
# Check if upload_website_audience exists in session state and is a dictionary
|
| 91 |
if 'upload_website_audience' in st.session_state and isinstance(st.session_state['upload_website_audience'], dict):
|
|
|
|
| 107 |
except Exception as e:
|
| 108 |
st.error(f"Error processing data: {str(e)}")
|
| 109 |
|
| 110 |
+
'''
|
| 111 |
# OUTPUT FOR SEO ANALYST
|
| 112 |
|
| 113 |
#result = self.request_model(payload_txt, headers)
|
|
|
|
| 134 |
def row1(self):
|
| 135 |
#st.write(self.data_src)
|
| 136 |
self.uploaded_files = st.file_uploader('Backlinks - SEMRush', type='csv', accept_multiple_files=True, key="seo_off")
|
| 137 |
+
#self.website_audience = st.file_uploader('Website Audience Acquisition - GA4', type='csv', accept_multiple_files=True, key="website_audiences")
|
| 138 |
#self.website_audience = st.text_input("Website Audience Acquisition:", placeholder='Enter Website Audience Acquisition')
|
| 139 |
|
| 140 |
if self.uploaded_files:
|
| 141 |
upload.multiple_upload_file(self.uploaded_files)
|
| 142 |
+
#if self.website_audience:
|
| 143 |
+
# upload.upload_website_audience(self.website_audience)
|
| 144 |
|
| 145 |
#st.write("") # FOR THE HIDE BUTTON
|
| 146 |
#st.write("") # FOR THE HIDE BUTTON
|
classes/response_website_audience_acquisition.py
CHANGED
|
@@ -71,10 +71,10 @@ class WebsiteAudienceAcquisition:
|
|
| 71 |
self.payload = ""
|
| 72 |
count = 0
|
| 73 |
try:
|
| 74 |
-
session_content_outside_the_website = st.session_state['
|
| 75 |
if session_content_outside_the_website == 'uploaded':
|
| 76 |
count += 1
|
| 77 |
-
self.payload += self.fetch_data("
|
| 78 |
except Exception as e:
|
| 79 |
pass
|
| 80 |
|
|
|
|
| 71 |
self.payload = ""
|
| 72 |
count = 0
|
| 73 |
try:
|
| 74 |
+
session_content_outside_the_website = st.session_state['others']
|
| 75 |
if session_content_outside_the_website == 'uploaded':
|
| 76 |
count += 1
|
| 77 |
+
self.payload += self.fetch_data("Traffic Acquisition")
|
| 78 |
except Exception as e:
|
| 79 |
pass
|
| 80 |
|