Spaces:
Build error
Build error
Ronio Jerico Roque commited on
Commit ·
e77d7d8
1
Parent(s): 7731ba6
Comment out output display in SeoOffPageAnalyst and update button behavior in home page
Browse files- classes/Off_Page.py +2 -4
- classes/response_content_process_and_assets_analyst.py +2 -2
- pages/home.py +19 -10
classes/Off_Page.py
CHANGED
|
@@ -75,7 +75,7 @@ class SeoOffPageAnalyst:
|
|
| 75 |
|
| 76 |
combined_text += f"Total Backlinks Count: {num_rows}\n"
|
| 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 |
except UnboundLocalError:
|
|
@@ -99,11 +99,9 @@ class SeoOffPageAnalyst:
|
|
| 99 |
# Instead of reading from StringIO, just use the DataFrame directly
|
| 100 |
website_audience += f"Website Audience Acquisition {df}\n"
|
| 101 |
|
| 102 |
-
st.info("Website Audience Acquisition Uploaded Successfully", icon="ℹ️")
|
| 103 |
except KeyError:
|
| 104 |
st.info(f"Incorrect format for {file_name}. Please upload a valid CSV file.")
|
| 105 |
-
else:
|
| 106 |
-
st.info("No website audience data available. Please upload CSV files first.")
|
| 107 |
except Exception as e:
|
| 108 |
st.error(f"Error processing data: {str(e)}")
|
| 109 |
|
|
|
|
| 75 |
|
| 76 |
combined_text += f"Total Backlinks Count: {num_rows}\n"
|
| 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 |
except UnboundLocalError:
|
|
|
|
| 99 |
# Instead of reading from StringIO, just use the DataFrame directly
|
| 100 |
website_audience += f"Website Audience Acquisition {df}\n"
|
| 101 |
|
| 102 |
+
#st.info("Website Audience Acquisition Uploaded Successfully", icon="ℹ️")
|
| 103 |
except KeyError:
|
| 104 |
st.info(f"Incorrect format for {file_name}. Please upload a valid CSV file.")
|
|
|
|
|
|
|
| 105 |
except Exception as e:
|
| 106 |
st.error(f"Error processing data: {str(e)}")
|
| 107 |
|
classes/response_content_process_and_assets_analyst.py
CHANGED
|
@@ -5,7 +5,7 @@ import os
|
|
| 5 |
from helper.upload_response import upload_response
|
| 6 |
from helper.upload_File import uploadFile
|
| 7 |
from pymongo import MongoClient
|
| 8 |
-
|
| 9 |
class Content_Process_and_Assets_Analyst:
|
| 10 |
def __init__(self, model_url):
|
| 11 |
self.uploaded_files = []
|
|
@@ -30,7 +30,7 @@ class Content_Process_and_Assets_Analyst:
|
|
| 30 |
output = response.json()
|
| 31 |
#st.write(output)
|
| 32 |
text = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]
|
| 33 |
-
|
| 34 |
#st.write(text)
|
| 35 |
return text
|
| 36 |
|
|
|
|
| 5 |
from helper.upload_response import upload_response
|
| 6 |
from helper.upload_File import uploadFile
|
| 7 |
from pymongo import MongoClient
|
| 8 |
+
import json
|
| 9 |
class Content_Process_and_Assets_Analyst:
|
| 10 |
def __init__(self, model_url):
|
| 11 |
self.uploaded_files = []
|
|
|
|
| 30 |
output = response.json()
|
| 31 |
#st.write(output)
|
| 32 |
text = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]
|
| 33 |
+
text = json.loads(text)
|
| 34 |
#st.write(text)
|
| 35 |
return text
|
| 36 |
|
pages/home.py
CHANGED
|
@@ -42,30 +42,39 @@ class DigitalFootprintDashboard:
|
|
| 42 |
st.session_state['analyze'] = ''
|
| 43 |
if 'analysis_completed' not in st.session_state:
|
| 44 |
st.session_state.analysis_completed = False
|
|
|
|
|
|
|
| 45 |
|
| 46 |
async def create_row1(self):
|
| 47 |
"""Create the first row with four columns"""
|
| 48 |
col1, col2, col3, col4, col5 = st.columns(5, border=True, gap="medium", vertical_alignment="top")
|
| 49 |
|
| 50 |
with col1:
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
st.session_state[
|
| 55 |
-
|
|
|
|
| 56 |
else:
|
| 57 |
st.session_state["analyze"] = ''
|
| 58 |
|
| 59 |
-
self.
|
| 60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
st.session_state.analysis_completed = False
|
| 62 |
st.switch_page("pages/analyzing_page.py")
|
| 63 |
-
|
| 64 |
-
hide_button()
|
| 65 |
|
| 66 |
self.client_summary = CientSummary()
|
| 67 |
|
| 68 |
-
|
| 69 |
with col2:
|
| 70 |
st.write("## Website Traffic")
|
| 71 |
self.backlinks = SeoOffPageAnalyst(os.getenv('MODEL_Off_Page_Analyst'))
|
|
|
|
| 42 |
st.session_state['analyze'] = ''
|
| 43 |
if 'analysis_completed' not in st.session_state:
|
| 44 |
st.session_state.analysis_completed = False
|
| 45 |
+
if 'uploading' not in st.session_state:
|
| 46 |
+
st.session_state['uploading'] = False
|
| 47 |
|
| 48 |
async def create_row1(self):
|
| 49 |
"""Create the first row with four columns"""
|
| 50 |
col1, col2, col3, col4, col5 = st.columns(5, border=True, gap="medium", vertical_alignment="top")
|
| 51 |
|
| 52 |
with col1:
|
| 53 |
+
button_label = "Uploading..." if st.session_state['uploading'] else "Sync Data"
|
| 54 |
+
if st.button(button_label, key="sync_button", icon="🔄", use_container_width=True):
|
| 55 |
+
st.session_state['uploading'] = True
|
| 56 |
+
st.session_state['analyze'] = 'clicked'
|
| 57 |
+
|
| 58 |
+
st.session_state['uploading'] = False
|
| 59 |
else:
|
| 60 |
st.session_state["analyze"] = ''
|
| 61 |
|
| 62 |
+
#self.upload_file_button = st.button("Sync Data", st.session_state['analyze'], icon="🔄", use_container_width=True)
|
| 63 |
+
|
| 64 |
+
#if self.upload_file_button == True:
|
| 65 |
+
# st.session_state["analyze"] = 'clicked'
|
| 66 |
+
#unhide_button()
|
| 67 |
+
#else:
|
| 68 |
+
# st.session_state["analyze"] = ''
|
| 69 |
+
|
| 70 |
+
analyze_disabled = st.session_state.get('analyze') != 'clicked'
|
| 71 |
+
if st.button("Analyze", key="analyze_button", icon="✨", use_container_width=True, disabled=analyze_disabled):
|
| 72 |
st.session_state.analysis_completed = False
|
| 73 |
st.switch_page("pages/analyzing_page.py")
|
| 74 |
+
|
|
|
|
| 75 |
|
| 76 |
self.client_summary = CientSummary()
|
| 77 |
|
|
|
|
| 78 |
with col2:
|
| 79 |
st.write("## Website Traffic")
|
| 80 |
self.backlinks = SeoOffPageAnalyst(os.getenv('MODEL_Off_Page_Analyst'))
|