Spaces:
Build error
Build error
Ronio Jerico Roque commited on
Commit ·
5f07f11
1
Parent(s): 923ad12
Add new analysis classes for LLD/PM/LN, Pull Through Offers, and Content; update website and tools integration
Browse files- classes/Tiktok.py +2 -2
- classes/content.py +81 -0
- classes/lld_pm_ln.py +73 -0
- classes/pull_through_offers.py +69 -0
- classes/response_content.py +146 -0
- classes/response_lld_pm_ln.py +130 -0
- classes/response_pull_through_offers.py +136 -0
- classes/response_website_and_tools.py +7 -11
- classes/website_and_tools.py +5 -52
- pages/analyzing_page.py +47 -2
- pages/home.py +6 -0
classes/Tiktok.py
CHANGED
|
@@ -155,9 +155,9 @@ class Tiktok:
|
|
| 155 |
followers = {
|
| 156 |
'Tiktok Followers': self.tiktok_f if self.tiktok_f else 'N/A'
|
| 157 |
}
|
| 158 |
-
tiktok_post = self.file_upload("Tiktok", "Tiktok Content post", "Tiktok")
|
| 159 |
|
| 160 |
-
tiktok_post
|
| 161 |
|
| 162 |
'''
|
| 163 |
st.write("") # FOR THE HIDE BUTTON
|
|
|
|
| 155 |
followers = {
|
| 156 |
'Tiktok Followers': self.tiktok_f if self.tiktok_f else 'N/A'
|
| 157 |
}
|
| 158 |
+
#tiktok_post = self.file_upload("Tiktok", "Tiktok Content post", "Tiktok")
|
| 159 |
|
| 160 |
+
#tiktok_post
|
| 161 |
|
| 162 |
'''
|
| 163 |
st.write("") # FOR THE HIDE BUTTON
|
classes/content.py
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
import os
|
| 5 |
+
import time
|
| 6 |
+
from helper.telemetry import collect_telemetry
|
| 7 |
+
from helper.upload_File import uploadFile
|
| 8 |
+
from helper.button_behaviour import hide_button, unhide_button
|
| 9 |
+
from helper.initialize_analyze_session import initialize_analyze_session
|
| 10 |
+
import pandas as pd
|
| 11 |
+
|
| 12 |
+
class Content:
|
| 13 |
+
def __init__(self, model_url):
|
| 14 |
+
self.uploaded_files = []
|
| 15 |
+
self.file_dict = {}
|
| 16 |
+
self.file_gt = {}
|
| 17 |
+
self.model_url = model_url
|
| 18 |
+
#self.analyst_name = analyst_name
|
| 19 |
+
#self.data_src = data_src
|
| 20 |
+
#self.analyst_description = analyst_description
|
| 21 |
+
self.initialize()
|
| 22 |
+
|
| 23 |
+
self.row1()
|
| 24 |
+
|
| 25 |
+
def initialize(self):
|
| 26 |
+
# FOR ENV
|
| 27 |
+
load_dotenv()
|
| 28 |
+
|
| 29 |
+
if 'content_in_the_website' not in st.session_state:
|
| 30 |
+
st.session_state['content_in_the_website'] = ''
|
| 31 |
+
if 'content_outside_the_website' not in st.session_state:
|
| 32 |
+
st.session_state['content_outside_the_website'] = ''
|
| 33 |
+
|
| 34 |
+
def process(self):
|
| 35 |
+
session = st.session_state.analyze
|
| 36 |
+
|
| 37 |
+
if (self.content_in_the_website or self.content_outside_the_website) and session == 'clicked':
|
| 38 |
+
with st.spinner('SEO On Page Analyst...', show_time=True):
|
| 39 |
+
st.write('')
|
| 40 |
+
content_in_the_website = ""
|
| 41 |
+
content_outside_the_website = ""
|
| 42 |
+
try:
|
| 43 |
+
content_in_the_website += f"\nContent in the Website: {self.content_in_the_website}"
|
| 44 |
+
except KeyError:
|
| 45 |
+
pass
|
| 46 |
+
try:
|
| 47 |
+
content_outside_the_website += f"\nContent outside the Website: {self.content_outside_the_website}"
|
| 48 |
+
except KeyError:
|
| 49 |
+
pass
|
| 50 |
+
|
| 51 |
+
debug_info_content_in_the_website = {'data_field' : 'Content in the Website', 'result': content_in_the_website}
|
| 52 |
+
debug_info_content_outside_the_website = {'data_field' : 'Content outside the Website', 'result': content_outside_the_website}
|
| 53 |
+
|
| 54 |
+
if self.content_in_the_website:
|
| 55 |
+
st.session_state['content_in_the_website'] = 'uploaded'
|
| 56 |
+
collect_telemetry(debug_info_content_in_the_website)
|
| 57 |
+
if self.content_outside_the_website:
|
| 58 |
+
st.session_state['content_outside_the_website'] = 'uploaded'
|
| 59 |
+
collect_telemetry(debug_info_content_outside_the_website)
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
#with st.expander("Debug information", icon="⚙"):
|
| 63 |
+
# st.write(debug_info)
|
| 64 |
+
|
| 65 |
+
|
| 66 |
+
st.session_state['analyzing'] = False
|
| 67 |
+
try:
|
| 68 |
+
self.file_dict.popitem()
|
| 69 |
+
except KeyError:
|
| 70 |
+
pass
|
| 71 |
+
|
| 72 |
+
def row1(self):
|
| 73 |
+
self.content_in_the_website = st.text_input("Content in the Website (Website Content)", placeholder='Enter Content in the Website')
|
| 74 |
+
self.content_outside_the_website = st.text_input("Content outside the Website (Website Content)", placeholder='Enter Content outside the Website')
|
| 75 |
+
|
| 76 |
+
self.process()
|
| 77 |
+
|
| 78 |
+
if __name__ == "__main__":
|
| 79 |
+
st.set_page_config(layout="wide")
|
| 80 |
+
|
| 81 |
+
upload = uploadFile()
|
classes/lld_pm_ln.py
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
import os
|
| 5 |
+
import time
|
| 6 |
+
from helper.telemetry import collect_telemetry
|
| 7 |
+
from helper.upload_File import uploadFile
|
| 8 |
+
from helper.button_behaviour import hide_button, unhide_button
|
| 9 |
+
from helper.initialize_analyze_session import initialize_analyze_session
|
| 10 |
+
import pandas as pd
|
| 11 |
+
|
| 12 |
+
class LLD_PM_LN:
|
| 13 |
+
def __init__(self, model_url):
|
| 14 |
+
self.uploaded_files = []
|
| 15 |
+
self.file_dict = {}
|
| 16 |
+
self.file_gt = {}
|
| 17 |
+
self.model_url = model_url
|
| 18 |
+
#self.analyst_name = analyst_name
|
| 19 |
+
#self.data_src = data_src
|
| 20 |
+
#self.analyst_description = analyst_description
|
| 21 |
+
self.initialize()
|
| 22 |
+
|
| 23 |
+
self.row1()
|
| 24 |
+
|
| 25 |
+
def initialize(self):
|
| 26 |
+
# FOR ENV
|
| 27 |
+
load_dotenv()
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
if 'lead_generation_mechanism' not in st.session_state:
|
| 31 |
+
st.session_state['lead_generation_mechanism'] = ''
|
| 32 |
+
|
| 33 |
+
def process(self):
|
| 34 |
+
session = st.session_state.analyze
|
| 35 |
+
if (self.lead_generation_mechanism) and session == 'clicked':
|
| 36 |
+
lead_generation_mechanism = ""
|
| 37 |
+
with st.spinner('SEO On Page Analyst...', show_time=True):
|
| 38 |
+
st.write('')
|
| 39 |
+
|
| 40 |
+
try:
|
| 41 |
+
lead_generation_mechanism += f"\nLead Generation Mechanism: {self.lead_generation_mechanism}"
|
| 42 |
+
except KeyError:
|
| 43 |
+
pass
|
| 44 |
+
|
| 45 |
+
debug_info_lead_generation_mechanism = {'data_field' : 'Lead Generation Mechanism', 'result': lead_generation_mechanism}
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
if self.lead_generation_mechanism:
|
| 49 |
+
st.session_state['lead_generation_mechanism'] = 'uploaded'
|
| 50 |
+
collect_telemetry(debug_info_lead_generation_mechanism)
|
| 51 |
+
|
| 52 |
+
|
| 53 |
+
|
| 54 |
+
#with st.expander("Debug information", icon="⚙"):
|
| 55 |
+
# st.write(debug_info)
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
st.session_state['analyzing'] = False
|
| 59 |
+
try:
|
| 60 |
+
self.file_dict.popitem()
|
| 61 |
+
except KeyError:
|
| 62 |
+
pass
|
| 63 |
+
|
| 64 |
+
def row1(self):
|
| 65 |
+
self.lead_generation_mechanism = st.text_input("Lead Generation Mechanism - Business Context (Lead Generation & Lead Nurturing):", placeholder='Enter Lead Generation Mechanism')
|
| 66 |
+
st.session_state['analyzing'] = False
|
| 67 |
+
|
| 68 |
+
self.process()
|
| 69 |
+
|
| 70 |
+
if __name__ == "__main__":
|
| 71 |
+
st.set_page_config(layout="wide")
|
| 72 |
+
|
| 73 |
+
upload = uploadFile()
|
classes/pull_through_offers.py
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
import os
|
| 5 |
+
import time
|
| 6 |
+
from helper.telemetry import collect_telemetry
|
| 7 |
+
from helper.upload_File import uploadFile
|
| 8 |
+
from helper.button_behaviour import hide_button, unhide_button
|
| 9 |
+
from helper.initialize_analyze_session import initialize_analyze_session
|
| 10 |
+
import pandas as pd
|
| 11 |
+
|
| 12 |
+
class PullThroughOffers:
|
| 13 |
+
def __init__(self, model_url):
|
| 14 |
+
self.model_url = model_url
|
| 15 |
+
#self.analyst_name = analyst_name
|
| 16 |
+
#self.data_src = data_src
|
| 17 |
+
#self.analyst_description = analyst_description
|
| 18 |
+
self.initialize()
|
| 19 |
+
|
| 20 |
+
self.row1()
|
| 21 |
+
|
| 22 |
+
def initialize(self):
|
| 23 |
+
# FOR ENV
|
| 24 |
+
load_dotenv()
|
| 25 |
+
|
| 26 |
+
if 'pull_through_offers' not in st.session_state:
|
| 27 |
+
st.session_state['pull_through_offers'] = ''
|
| 28 |
+
|
| 29 |
+
def process(self):
|
| 30 |
+
session = st.session_state.analyze
|
| 31 |
+
if (self.pull_through_offers) and session == 'clicked':
|
| 32 |
+
pull_through_offers = ""
|
| 33 |
+
with st.spinner('SEO On Page Analyst...', show_time=True):
|
| 34 |
+
st.write('')
|
| 35 |
+
|
| 36 |
+
try:
|
| 37 |
+
pull_through_offers += f"\nPull Through Offers: {self.pull_through_offers}"
|
| 38 |
+
except KeyError:
|
| 39 |
+
pass
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
debug_info_pull_through_offers = {'data_field' : 'Pull through offers', 'result': pull_through_offers}
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
if self.pull_through_offers:
|
| 47 |
+
st.session_state['pull_through_offers'] = 'uploaded'
|
| 48 |
+
collect_telemetry(debug_info_pull_through_offers)
|
| 49 |
+
|
| 50 |
+
|
| 51 |
+
|
| 52 |
+
#with st.expander("Debug information", icon="⚙"):
|
| 53 |
+
# st.write(debug_info)
|
| 54 |
+
|
| 55 |
+
|
| 56 |
+
st.session_state['analyzing'] = False
|
| 57 |
+
|
| 58 |
+
def row1(self):
|
| 59 |
+
|
| 60 |
+
self.pull_through_offers = st.text_input("Pull through offers (Business Context)", placeholder='Enter Pull through offers')
|
| 61 |
+
|
| 62 |
+
st.session_state['analyzing'] = False
|
| 63 |
+
|
| 64 |
+
self.process()
|
| 65 |
+
|
| 66 |
+
if __name__ == "__main__":
|
| 67 |
+
st.set_page_config(layout="wide")
|
| 68 |
+
|
| 69 |
+
upload = uploadFile()
|
classes/response_content.py
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
import os
|
| 5 |
+
import time
|
| 6 |
+
from helper.telemetry import collect_telemetry
|
| 7 |
+
from helper.upload_File import uploadFile
|
| 8 |
+
from helper.button_behaviour import hide_button, unhide_button
|
| 9 |
+
from helper.initialize_analyze_session import initialize_analyze_session
|
| 10 |
+
import pandas as pd
|
| 11 |
+
from pymongo import MongoClient
|
| 12 |
+
import json
|
| 13 |
+
from helper.data_field import data_field
|
| 14 |
+
from helper.upload_response import upload_response
|
| 15 |
+
|
| 16 |
+
class Content:
|
| 17 |
+
def __init__(self, model_url):
|
| 18 |
+
self.uploaded_files = []
|
| 19 |
+
self.file_dict = {}
|
| 20 |
+
self.file_gt = {}
|
| 21 |
+
self.model_url = model_url
|
| 22 |
+
#self.analyst_name = analyst_name
|
| 23 |
+
#self.data_src = data_src
|
| 24 |
+
#self.analyst_description = analyst_description
|
| 25 |
+
self.initialize()
|
| 26 |
+
|
| 27 |
+
self.row1()
|
| 28 |
+
|
| 29 |
+
def initialize(self):
|
| 30 |
+
# FOR ENV
|
| 31 |
+
load_dotenv()
|
| 32 |
+
|
| 33 |
+
# AGENT NAME
|
| 34 |
+
#st.header(self.analyst_name)
|
| 35 |
+
|
| 36 |
+
# EVALUATION FORM LINK
|
| 37 |
+
#url = os.getenv('Link')
|
| 38 |
+
#st.write('Evaluation Form: [Link](%s)' % url)
|
| 39 |
+
|
| 40 |
+
# RETURN BUTTON
|
| 41 |
+
'''try:
|
| 42 |
+
if st.button("Return", type='primary'):
|
| 43 |
+
st.switch_page("./pages/home.py")
|
| 44 |
+
except Exception:
|
| 45 |
+
pass'''
|
| 46 |
+
|
| 47 |
+
def request_model(self, payload_txt, headers):
|
| 48 |
+
response = requests.post(self.model_url, json=payload_txt, headers=headers)
|
| 49 |
+
response.raise_for_status()
|
| 50 |
+
|
| 51 |
+
output = response.json()
|
| 52 |
+
text = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]
|
| 53 |
+
text = json.loads(text)
|
| 54 |
+
#st.write(text)
|
| 55 |
+
return text
|
| 56 |
+
|
| 57 |
+
def fetch_data(self, data_field):
|
| 58 |
+
mongodb_uri = os.getenv("MONGODB_URI")
|
| 59 |
+
myclient = MongoClient(mongodb_uri)
|
| 60 |
+
mydb = myclient.get_database()
|
| 61 |
+
mycol = mydb["df_data"]
|
| 62 |
+
|
| 63 |
+
# Sort by timestamp field in descending order
|
| 64 |
+
x = mycol.find_one(
|
| 65 |
+
{"data_field": data_field},
|
| 66 |
+
sort=[("timestamp", -1)]
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
x = x["result"]
|
| 70 |
+
return x
|
| 71 |
+
|
| 72 |
+
def process(self):
|
| 73 |
+
with st.spinner('Content Analyst...', show_time=True):
|
| 74 |
+
st.write('')
|
| 75 |
+
headers = {"Content-Type": "application/json", "x-api-key": f"{os.getenv('x-api-key')}"}
|
| 76 |
+
try:
|
| 77 |
+
payload_txt = {"input_value": self.payload, "output_type": "text", "input_type": "chat"}
|
| 78 |
+
payload_txt_model = self.request_model(payload_txt, headers)
|
| 79 |
+
debug_info = {'data_field' : 'Content Analyst', 'result': payload_txt_model}
|
| 80 |
+
upload_response(debug_info)
|
| 81 |
+
|
| 82 |
+
st.session_state['content_in_the_website'] = ''
|
| 83 |
+
st.session_state['content_outside_the_website'] = ''
|
| 84 |
+
|
| 85 |
+
count = 0
|
| 86 |
+
except Exception as e:
|
| 87 |
+
pass
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
#end_time = time.time()
|
| 91 |
+
#time_lapsed = end_time - start_time
|
| 92 |
+
|
| 93 |
+
#debug_info = {'data_field' : 'GT Metrix', 'result': result}
|
| 94 |
+
|
| 95 |
+
|
| 96 |
+
'''
|
| 97 |
+
debug_info = {#'analyst': self.analyst_name,
|
| 98 |
+
'url_uuid': self.model_url.split("-")[-1],
|
| 99 |
+
'time_lapsed' : time_lapsed,
|
| 100 |
+
'crawl_file': [file.name for file in self.uploaded_files] if self.uploaded_files else ['Not available'],
|
| 101 |
+
'gt_metrix': [file.name for file in self.gtmetrix] if self.gtmetrix else ['Not available'],
|
| 102 |
+
'payload': payload_txt,
|
| 103 |
+
'result': result}
|
| 104 |
+
|
| 105 |
+
if self.gtmetrix:
|
| 106 |
+
collect_telemetry(debug_info)
|
| 107 |
+
'''
|
| 108 |
+
|
| 109 |
+
|
| 110 |
+
#with st.expander("Debug information", icon="⚙"):
|
| 111 |
+
# st.write(debug_info)
|
| 112 |
+
|
| 113 |
+
|
| 114 |
+
st.session_state['analyzing'] = False
|
| 115 |
+
try:
|
| 116 |
+
self.file_dict.popitem()
|
| 117 |
+
except KeyError:
|
| 118 |
+
pass
|
| 119 |
+
|
| 120 |
+
def row1(self):
|
| 121 |
+
st.session_state['analyzing'] = False
|
| 122 |
+
self.payload = ""
|
| 123 |
+
count = 0
|
| 124 |
+
|
| 125 |
+
try:
|
| 126 |
+
session_content_in_the_website = st.session_state['content_in_the_website']
|
| 127 |
+
if session_content_in_the_website == 'uploaded':
|
| 128 |
+
count += 1
|
| 129 |
+
self.payload += self.fetch_data("Content in the Website")
|
| 130 |
+
except Exception as e:
|
| 131 |
+
pass
|
| 132 |
+
try:
|
| 133 |
+
session_content_outside_the_website = st.session_state['content_outside_the_website']
|
| 134 |
+
if session_content_outside_the_website == 'uploaded':
|
| 135 |
+
count += 1
|
| 136 |
+
self.payload += self.fetch_data("Content outside the Website")
|
| 137 |
+
except Exception as e:
|
| 138 |
+
pass
|
| 139 |
+
|
| 140 |
+
if count >= 1:
|
| 141 |
+
self.process()
|
| 142 |
+
|
| 143 |
+
if __name__ == "__main__":
|
| 144 |
+
st.set_page_config(layout="wide")
|
| 145 |
+
|
| 146 |
+
upload = uploadFile()
|
classes/response_lld_pm_ln.py
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
import os
|
| 5 |
+
import time
|
| 6 |
+
from helper.telemetry import collect_telemetry
|
| 7 |
+
from helper.upload_File import uploadFile
|
| 8 |
+
from helper.button_behaviour import hide_button, unhide_button
|
| 9 |
+
from helper.initialize_analyze_session import initialize_analyze_session
|
| 10 |
+
import pandas as pd
|
| 11 |
+
from pymongo import MongoClient
|
| 12 |
+
import json
|
| 13 |
+
from helper.data_field import data_field
|
| 14 |
+
from helper.upload_response import upload_response
|
| 15 |
+
|
| 16 |
+
class LLD_PM_LN:
|
| 17 |
+
def __init__(self, model_url):
|
| 18 |
+
self.uploaded_files = []
|
| 19 |
+
self.file_dict = {}
|
| 20 |
+
self.file_gt = {}
|
| 21 |
+
self.model_url = model_url
|
| 22 |
+
#self.analyst_name = analyst_name
|
| 23 |
+
#self.data_src = data_src
|
| 24 |
+
#self.analyst_description = analyst_description
|
| 25 |
+
self.initialize()
|
| 26 |
+
|
| 27 |
+
self.row1()
|
| 28 |
+
|
| 29 |
+
def initialize(self):
|
| 30 |
+
# FOR ENV
|
| 31 |
+
load_dotenv()
|
| 32 |
+
|
| 33 |
+
# AGENT NAME
|
| 34 |
+
#st.header(self.analyst_name)
|
| 35 |
+
|
| 36 |
+
# EVALUATION FORM LINK
|
| 37 |
+
#url = os.getenv('Link')
|
| 38 |
+
#st.write('Evaluation Form: [Link](%s)' % url)
|
| 39 |
+
|
| 40 |
+
# RETURN BUTTON
|
| 41 |
+
'''try:
|
| 42 |
+
if st.button("Return", type='primary'):
|
| 43 |
+
st.switch_page("./pages/home.py")
|
| 44 |
+
except Exception:
|
| 45 |
+
pass'''
|
| 46 |
+
|
| 47 |
+
def request_model(self, payload_txt, headers):
|
| 48 |
+
response = requests.post(self.model_url, json=payload_txt, headers=headers)
|
| 49 |
+
response.raise_for_status()
|
| 50 |
+
output = response.json()
|
| 51 |
+
#st.write(output)
|
| 52 |
+
text = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]
|
| 53 |
+
#st.write(text)
|
| 54 |
+
text = json.loads(text)
|
| 55 |
+
#st.write(text)
|
| 56 |
+
return text
|
| 57 |
+
|
| 58 |
+
def fetch_data(self, data_field):
|
| 59 |
+
mongodb_uri = os.getenv("MONGODB_URI")
|
| 60 |
+
myclient = MongoClient(mongodb_uri)
|
| 61 |
+
mydb = myclient.get_database()
|
| 62 |
+
mycol = mydb["df_data"]
|
| 63 |
+
|
| 64 |
+
# Sort by timestamp field in descending order
|
| 65 |
+
x = mycol.find_one(
|
| 66 |
+
{"data_field": data_field},
|
| 67 |
+
sort=[("timestamp", -1)]
|
| 68 |
+
)
|
| 69 |
+
|
| 70 |
+
x = x["result"]
|
| 71 |
+
return x
|
| 72 |
+
|
| 73 |
+
def process(self):
|
| 74 |
+
with st.spinner('LLD/PM/LN Analyst...', show_time=True):
|
| 75 |
+
st.write('')
|
| 76 |
+
headers = {"Content-Type": "application/json", "x-api-key": f"{os.getenv('x-api-key')}"}
|
| 77 |
+
try:
|
| 78 |
+
payload_txt = {"input_value": self.payload, "output_type": "text", "input_type": "chat"}
|
| 79 |
+
payload_txt_model = self.request_model(payload_txt, headers)
|
| 80 |
+
debug_info = {'data_field' : 'LLD/PM/LN Analyst', 'result': payload_txt_model}
|
| 81 |
+
upload_response(debug_info)
|
| 82 |
+
|
| 83 |
+
st.session_state['lead_generation_mechanism'] = ''
|
| 84 |
+
count = 0
|
| 85 |
+
except Exception as e:
|
| 86 |
+
pass
|
| 87 |
+
|
| 88 |
+
|
| 89 |
+
#end_time = time.time()
|
| 90 |
+
#time_lapsed = end_time - start_time
|
| 91 |
+
|
| 92 |
+
#debug_info = {'data_field' : 'GT Metrix', 'result': result}
|
| 93 |
+
|
| 94 |
+
|
| 95 |
+
'''
|
| 96 |
+
debug_info = {#'analyst': self.analyst_name,
|
| 97 |
+
'url_uuid': self.model_url.split("-")[-1],
|
| 98 |
+
'time_lapsed' : time_lapsed,
|
| 99 |
+
'crawl_file': [file.name for file in self.uploaded_files] if self.uploaded_files else ['Not available'],
|
| 100 |
+
'gt_metrix': [file.name for file in self.gtmetrix] if self.gtmetrix else ['Not available'],
|
| 101 |
+
'payload': payload_txt,
|
| 102 |
+
'result': result}
|
| 103 |
+
|
| 104 |
+
if self.gtmetrix:
|
| 105 |
+
collect_telemetry(debug_info)
|
| 106 |
+
'''
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
#with st.expander("Debug information", icon="⚙"):
|
| 110 |
+
# st.write(debug_info)
|
| 111 |
+
|
| 112 |
+
def row1(self):
|
| 113 |
+
st.session_state['analyzing'] = False
|
| 114 |
+
self.payload = ""
|
| 115 |
+
count = 0
|
| 116 |
+
try:
|
| 117 |
+
session_lead_generation_mechanism = st.session_state['lead_generation_mechanism']
|
| 118 |
+
if session_lead_generation_mechanism == 'uploaded':
|
| 119 |
+
count += 1
|
| 120 |
+
self.payload += self.fetch_data("Lead Generation Mechanism")
|
| 121 |
+
|
| 122 |
+
except Exception as e:
|
| 123 |
+
pass
|
| 124 |
+
if count >= 1:
|
| 125 |
+
self.process()
|
| 126 |
+
|
| 127 |
+
if __name__ == "__main__":
|
| 128 |
+
st.set_page_config(layout="wide")
|
| 129 |
+
|
| 130 |
+
upload = uploadFile()
|
classes/response_pull_through_offers.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
from dotenv import load_dotenv
|
| 4 |
+
import os
|
| 5 |
+
import time
|
| 6 |
+
from helper.telemetry import collect_telemetry
|
| 7 |
+
from helper.upload_File import uploadFile
|
| 8 |
+
from helper.button_behaviour import hide_button, unhide_button
|
| 9 |
+
from helper.initialize_analyze_session import initialize_analyze_session
|
| 10 |
+
import pandas as pd
|
| 11 |
+
from pymongo import MongoClient
|
| 12 |
+
import json
|
| 13 |
+
from helper.data_field import data_field
|
| 14 |
+
from helper.upload_response import upload_response
|
| 15 |
+
|
| 16 |
+
class PullThroughOffers:
|
| 17 |
+
def __init__(self, model_url):
|
| 18 |
+
self.uploaded_files = []
|
| 19 |
+
self.file_dict = {}
|
| 20 |
+
self.file_gt = {}
|
| 21 |
+
self.model_url = model_url
|
| 22 |
+
#self.analyst_name = analyst_name
|
| 23 |
+
#self.data_src = data_src
|
| 24 |
+
#self.analyst_description = analyst_description
|
| 25 |
+
self.initialize()
|
| 26 |
+
|
| 27 |
+
self.row1()
|
| 28 |
+
|
| 29 |
+
def initialize(self):
|
| 30 |
+
# FOR ENV
|
| 31 |
+
load_dotenv()
|
| 32 |
+
|
| 33 |
+
# AGENT NAME
|
| 34 |
+
#st.header(self.analyst_name)
|
| 35 |
+
|
| 36 |
+
# EVALUATION FORM LINK
|
| 37 |
+
#url = os.getenv('Link')
|
| 38 |
+
#st.write('Evaluation Form: [Link](%s)' % url)
|
| 39 |
+
|
| 40 |
+
# RETURN BUTTON
|
| 41 |
+
'''try:
|
| 42 |
+
if st.button("Return", type='primary'):
|
| 43 |
+
st.switch_page("./pages/home.py")
|
| 44 |
+
except Exception:
|
| 45 |
+
pass'''
|
| 46 |
+
|
| 47 |
+
def request_model(self, payload_txt, headers):
|
| 48 |
+
response = requests.post(self.model_url, json=payload_txt, headers=headers)
|
| 49 |
+
response.raise_for_status()
|
| 50 |
+
output = response.json()
|
| 51 |
+
text = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]
|
| 52 |
+
#st.write(text)
|
| 53 |
+
#text = json.loads(text)
|
| 54 |
+
#st.write(text)
|
| 55 |
+
return text
|
| 56 |
+
|
| 57 |
+
def fetch_data(self, data_field):
|
| 58 |
+
mongodb_uri = os.getenv("MONGODB_URI")
|
| 59 |
+
myclient = MongoClient(mongodb_uri)
|
| 60 |
+
mydb = myclient.get_database()
|
| 61 |
+
mycol = mydb["df_data"]
|
| 62 |
+
|
| 63 |
+
# Sort by timestamp field in descending order
|
| 64 |
+
x = mycol.find_one(
|
| 65 |
+
{"data_field": data_field},
|
| 66 |
+
sort=[("timestamp", -1)]
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
x = x["result"]
|
| 70 |
+
return x
|
| 71 |
+
|
| 72 |
+
def process(self):
|
| 73 |
+
with st.spinner('Pull through offers...', show_time=True):
|
| 74 |
+
st.write('')
|
| 75 |
+
headers = {"Content-Type": "application/json", "x-api-key": f"{os.getenv('x-api-key')}"}
|
| 76 |
+
try:
|
| 77 |
+
payload_txt = {"input_value": self.payload, "output_type": "text", "input_type": "chat"}
|
| 78 |
+
payload_txt_model = self.request_model(payload_txt, headers)
|
| 79 |
+
debug_info = {'data_field' : 'Pull through offers Analyst', 'result': payload_txt_model}
|
| 80 |
+
upload_response(debug_info)
|
| 81 |
+
|
| 82 |
+
st.session_state['pull_through_offers'] = ''
|
| 83 |
+
count = 0
|
| 84 |
+
except Exception as e:
|
| 85 |
+
pass
|
| 86 |
+
|
| 87 |
+
|
| 88 |
+
#end_time = time.time()
|
| 89 |
+
#time_lapsed = end_time - start_time
|
| 90 |
+
|
| 91 |
+
#debug_info = {'data_field' : 'GT Metrix', 'result': result}
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
'''
|
| 95 |
+
debug_info = {#'analyst': self.analyst_name,
|
| 96 |
+
'url_uuid': self.model_url.split("-")[-1],
|
| 97 |
+
'time_lapsed' : time_lapsed,
|
| 98 |
+
'crawl_file': [file.name for file in self.uploaded_files] if self.uploaded_files else ['Not available'],
|
| 99 |
+
'gt_metrix': [file.name for file in self.gtmetrix] if self.gtmetrix else ['Not available'],
|
| 100 |
+
'payload': payload_txt,
|
| 101 |
+
'result': result}
|
| 102 |
+
|
| 103 |
+
if self.gtmetrix:
|
| 104 |
+
collect_telemetry(debug_info)
|
| 105 |
+
'''
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
#with st.expander("Debug information", icon="⚙"):
|
| 109 |
+
# st.write(debug_info)
|
| 110 |
+
|
| 111 |
+
|
| 112 |
+
st.session_state['analyzing'] = False
|
| 113 |
+
try:
|
| 114 |
+
self.file_dict.popitem()
|
| 115 |
+
except KeyError:
|
| 116 |
+
pass
|
| 117 |
+
|
| 118 |
+
def row1(self):
|
| 119 |
+
st.session_state['analyzing'] = False
|
| 120 |
+
self.payload = ""
|
| 121 |
+
count = 0
|
| 122 |
+
try:
|
| 123 |
+
session_pull_through_offers = st.session_state['pull_through_offers']
|
| 124 |
+
if session_pull_through_offers == 'uploaded':
|
| 125 |
+
count += 1
|
| 126 |
+
self.payload += self.fetch_data("Pull through offers")
|
| 127 |
+
except Exception as e:
|
| 128 |
+
pass
|
| 129 |
+
|
| 130 |
+
if count >= 1:
|
| 131 |
+
self.process()
|
| 132 |
+
|
| 133 |
+
if __name__ == "__main__":
|
| 134 |
+
st.set_page_config(layout="wide")
|
| 135 |
+
|
| 136 |
+
upload = uploadFile()
|
classes/response_website_and_tools.py
CHANGED
|
@@ -72,8 +72,7 @@ class WebsiteAndTools:
|
|
| 72 |
def process(self):
|
| 73 |
with st.spinner('Website and Tools...', show_time=True):
|
| 74 |
st.write('')
|
| 75 |
-
headers = {"Content-Type": "application/json", "x-api-key": f"{os.getenv('x-api-key')}"}
|
| 76 |
-
|
| 77 |
try:
|
| 78 |
payload_txt = {"input_value": self.payload, "output_type": "text", "input_type": "chat"}
|
| 79 |
payload_txt_model = self.request_model(payload_txt, headers)
|
|
@@ -88,10 +87,12 @@ class WebsiteAndTools:
|
|
| 88 |
st.session_state['first_meaningful_paint'] = ''
|
| 89 |
st.session_state['web_analytics'] = ''
|
| 90 |
st.session_state['client_relations_management_system'] = ''
|
| 91 |
-
st.session_state['lead_generation_mechanism'] = ''
|
| 92 |
count = 0
|
| 93 |
except Exception as e:
|
| 94 |
pass
|
|
|
|
|
|
|
| 95 |
#end_time = time.time()
|
| 96 |
#time_lapsed = end_time - start_time
|
| 97 |
|
|
@@ -125,9 +126,9 @@ class WebsiteAndTools:
|
|
| 125 |
def row1(self):
|
| 126 |
st.session_state['analyzing'] = False
|
| 127 |
self.payload = ""
|
|
|
|
| 128 |
count = 0
|
| 129 |
try:
|
| 130 |
-
payload = ""
|
| 131 |
session_website_responsiveness = st.session_state['website_responsiveness']
|
| 132 |
if session_website_responsiveness == 'uploaded':
|
| 133 |
count += 1
|
|
@@ -191,13 +192,8 @@ class WebsiteAndTools:
|
|
| 191 |
self.payload += self.fetch_data("Client Relations Management System")
|
| 192 |
except Exception as e:
|
| 193 |
pass
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
if session_lead_generation_mechanism == 'uploaded':
|
| 197 |
-
count += 1
|
| 198 |
-
self.payload += self.fetch_data("Lead Generation Mechanism")
|
| 199 |
-
except Exception as e:
|
| 200 |
-
pass
|
| 201 |
if count >= 1:
|
| 202 |
self.process()
|
| 203 |
|
|
|
|
| 72 |
def process(self):
|
| 73 |
with st.spinner('Website and Tools...', show_time=True):
|
| 74 |
st.write('')
|
| 75 |
+
headers = {"Content-Type": "application/json", "x-api-key": f"{os.getenv('x-api-key')}"}
|
|
|
|
| 76 |
try:
|
| 77 |
payload_txt = {"input_value": self.payload, "output_type": "text", "input_type": "chat"}
|
| 78 |
payload_txt_model = self.request_model(payload_txt, headers)
|
|
|
|
| 87 |
st.session_state['first_meaningful_paint'] = ''
|
| 88 |
st.session_state['web_analytics'] = ''
|
| 89 |
st.session_state['client_relations_management_system'] = ''
|
| 90 |
+
#st.session_state['lead_generation_mechanism'] = ''
|
| 91 |
count = 0
|
| 92 |
except Exception as e:
|
| 93 |
pass
|
| 94 |
+
|
| 95 |
+
|
| 96 |
#end_time = time.time()
|
| 97 |
#time_lapsed = end_time - start_time
|
| 98 |
|
|
|
|
| 126 |
def row1(self):
|
| 127 |
st.session_state['analyzing'] = False
|
| 128 |
self.payload = ""
|
| 129 |
+
|
| 130 |
count = 0
|
| 131 |
try:
|
|
|
|
| 132 |
session_website_responsiveness = st.session_state['website_responsiveness']
|
| 133 |
if session_website_responsiveness == 'uploaded':
|
| 134 |
count += 1
|
|
|
|
| 192 |
self.payload += self.fetch_data("Client Relations Management System")
|
| 193 |
except Exception as e:
|
| 194 |
pass
|
| 195 |
+
|
| 196 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
if count >= 1:
|
| 198 |
self.process()
|
| 199 |
|
classes/website_and_tools.py
CHANGED
|
@@ -55,48 +55,11 @@ class WebsiteAndTools:
|
|
| 55 |
st.session_state['web_analytics'] = ''
|
| 56 |
if 'client_relations_management_system' not in st.session_state:
|
| 57 |
st.session_state['client_relations_management_system'] = ''
|
| 58 |
-
if 'lead_generation_mechanism' not in st.session_state:
|
| 59 |
-
st.session_state['lead_generation_mechanism'] = ''
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
def request_model(self, payload_txt):
|
| 63 |
-
response = requests.post(self.model_url, json=payload_txt)
|
| 64 |
-
response.raise_for_status()
|
| 65 |
-
output = response.json()
|
| 66 |
-
|
| 67 |
-
categories = []
|
| 68 |
-
remarks = []
|
| 69 |
-
|
| 70 |
-
for key, value in output.items():
|
| 71 |
-
if key == 'json':
|
| 72 |
-
for item in value:
|
| 73 |
-
categories.append(item.get('elements', 'N/A').replace('_', ' ').title())
|
| 74 |
-
remarks.append(item.get('remarks', 'N/A'))
|
| 75 |
-
|
| 76 |
-
output = ""
|
| 77 |
-
for i in range(len(categories)):
|
| 78 |
-
output += f"\n\n---\n **Category:** {categories[i]}"
|
| 79 |
-
output += f"\n\n **Remarks:** {remarks[i]}\n\n"
|
| 80 |
-
|
| 81 |
-
data = {
|
| 82 |
-
"Category": [str(category) for category in categories],
|
| 83 |
-
"Remarks": [str(footprint) for footprint in remarks],
|
| 84 |
-
}
|
| 85 |
-
df_output = pd.DataFrame(data)
|
| 86 |
-
'''
|
| 87 |
-
with st.expander("AI Analysis", expanded=True, icon="🤖"):
|
| 88 |
-
st.table(df_output.style.set_table_styles(
|
| 89 |
-
[{'selector': 'th:first-child, td:first-child', 'props': [('width', '20px')]},
|
| 90 |
-
{'selector': 'th, td', 'props': [('width', '150px'), ('text-align', 'center')]}]
|
| 91 |
-
).set_properties(**{'text-align': 'center'}))
|
| 92 |
-
'''
|
| 93 |
-
|
| 94 |
-
return output
|
| 95 |
|
| 96 |
def process(self):
|
| 97 |
session = st.session_state.analyze
|
| 98 |
start_time = time.time()
|
| 99 |
-
if (self.website_responsiveness or self.content_management_system or self.SSL_certificate or self.web_analytics or self.client_relations_management_system or self.
|
| 100 |
website_responsiveness = ""
|
| 101 |
content_management_system = ""
|
| 102 |
SSL_certificate = ""
|
|
@@ -106,7 +69,7 @@ class WebsiteAndTools:
|
|
| 106 |
web_analytics = ""
|
| 107 |
client_relations_management_system = ""
|
| 108 |
mobile_loading_speed = ""
|
| 109 |
-
|
| 110 |
with st.spinner('SEO On Page Analyst...', show_time=True):
|
| 111 |
st.write('')
|
| 112 |
'''
|
|
@@ -164,11 +127,6 @@ class WebsiteAndTools:
|
|
| 164 |
client_relations_management_system += f"\nClient Relations Management System: {self.client_relations_management_system}"
|
| 165 |
except KeyError:
|
| 166 |
pass
|
| 167 |
-
try:
|
| 168 |
-
lead_generation_mechanism += f"\nLead Generation Mechanism: {self.lead_generation_mechanism}"
|
| 169 |
-
except KeyError:
|
| 170 |
-
pass
|
| 171 |
-
|
| 172 |
|
| 173 |
# OUTPUT FOR WEBSITE RESPONSIVENESS
|
| 174 |
payload_txt_website_responsiveness = {"question": website_responsiveness}
|
|
@@ -191,8 +149,6 @@ class WebsiteAndTools:
|
|
| 191 |
#result_client_relations_management_system = self.request_model(client_relations_management_system)
|
| 192 |
|
| 193 |
# OUTPUT FOR LEAD GENERATION MECHANISM
|
| 194 |
-
payload_txt_lead_generation_mechanism = {"question": lead_generation_mechanism}
|
| 195 |
-
#result_lead_generation_mechanism = self.request_model(lead_generation_mechanism)
|
| 196 |
|
| 197 |
# OUTPUT FOR SEO ANALYST
|
| 198 |
#payload_txt = {"question": combined_text}
|
|
@@ -208,7 +164,7 @@ class WebsiteAndTools:
|
|
| 208 |
debug_info_mobile_loading_speed = {'data_field' : 'Mobile Loading Speed', 'result': mobile_loading_speed}
|
| 209 |
debug_info_web_analytics = {'data_field' : 'Web Analytics', 'result': web_analytics}
|
| 210 |
debug_info_client_relations_management_system = {'data_field' : 'Client Relations Management System', 'result': client_relations_management_system}
|
| 211 |
-
|
| 212 |
'''
|
| 213 |
debug_info = {#'analyst': self.analyst_name,
|
| 214 |
'url_uuid': self.model_url.split("-")[-1],
|
|
@@ -245,9 +201,7 @@ class WebsiteAndTools:
|
|
| 245 |
if self.client_relations_management_system:
|
| 246 |
st.session_state['client_relations_management_system'] = 'uploaded'
|
| 247 |
collect_telemetry(debug_info_client_relations_management_system)
|
| 248 |
-
|
| 249 |
-
st.session_state['lead_generation_mechanism'] = 'uploaded'
|
| 250 |
-
collect_telemetry(debug_info_lead_generation_mechanism)
|
| 251 |
|
| 252 |
#with st.expander("Debug information", icon="⚙"):
|
| 253 |
# st.write(debug_info)
|
|
@@ -279,8 +233,7 @@ class WebsiteAndTools:
|
|
| 279 |
self.mobile_loading_speed = st.text_input("Mobile Loading Speed - GTMetrix:", placeholder='Enter Mobile Loading Speed')
|
| 280 |
self.web_analytics = st.text_input("Web Analytics - BuiltWith (GA4):", placeholder='Enter Web Analytics')
|
| 281 |
self.client_relations_management_system = st.text_input("Client Relations Management System - BuiltWith:", placeholder='Enter Client Relations Management System')
|
| 282 |
-
|
| 283 |
-
|
| 284 |
#st.write("") # FOR THE HIDE BUTTON
|
| 285 |
#st.write("") # FOR THE HIDE BUTTON
|
| 286 |
#st.write("AI Analyst Output: ")
|
|
|
|
| 55 |
st.session_state['web_analytics'] = ''
|
| 56 |
if 'client_relations_management_system' not in st.session_state:
|
| 57 |
st.session_state['client_relations_management_system'] = ''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
def process(self):
|
| 60 |
session = st.session_state.analyze
|
| 61 |
start_time = time.time()
|
| 62 |
+
if (self.website_responsiveness or self.content_management_system or self.SSL_certificate or self.web_analytics or self.client_relations_management_system or self.mobile_responsiveness or self.mobile_loading_speed or self.desktop_loading_speed) and session == 'clicked':
|
| 63 |
website_responsiveness = ""
|
| 64 |
content_management_system = ""
|
| 65 |
SSL_certificate = ""
|
|
|
|
| 69 |
web_analytics = ""
|
| 70 |
client_relations_management_system = ""
|
| 71 |
mobile_loading_speed = ""
|
| 72 |
+
|
| 73 |
with st.spinner('SEO On Page Analyst...', show_time=True):
|
| 74 |
st.write('')
|
| 75 |
'''
|
|
|
|
| 127 |
client_relations_management_system += f"\nClient Relations Management System: {self.client_relations_management_system}"
|
| 128 |
except KeyError:
|
| 129 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
|
| 131 |
# OUTPUT FOR WEBSITE RESPONSIVENESS
|
| 132 |
payload_txt_website_responsiveness = {"question": website_responsiveness}
|
|
|
|
| 149 |
#result_client_relations_management_system = self.request_model(client_relations_management_system)
|
| 150 |
|
| 151 |
# OUTPUT FOR LEAD GENERATION MECHANISM
|
|
|
|
|
|
|
| 152 |
|
| 153 |
# OUTPUT FOR SEO ANALYST
|
| 154 |
#payload_txt = {"question": combined_text}
|
|
|
|
| 164 |
debug_info_mobile_loading_speed = {'data_field' : 'Mobile Loading Speed', 'result': mobile_loading_speed}
|
| 165 |
debug_info_web_analytics = {'data_field' : 'Web Analytics', 'result': web_analytics}
|
| 166 |
debug_info_client_relations_management_system = {'data_field' : 'Client Relations Management System', 'result': client_relations_management_system}
|
| 167 |
+
|
| 168 |
'''
|
| 169 |
debug_info = {#'analyst': self.analyst_name,
|
| 170 |
'url_uuid': self.model_url.split("-")[-1],
|
|
|
|
| 201 |
if self.client_relations_management_system:
|
| 202 |
st.session_state['client_relations_management_system'] = 'uploaded'
|
| 203 |
collect_telemetry(debug_info_client_relations_management_system)
|
| 204 |
+
|
|
|
|
|
|
|
| 205 |
|
| 206 |
#with st.expander("Debug information", icon="⚙"):
|
| 207 |
# st.write(debug_info)
|
|
|
|
| 233 |
self.mobile_loading_speed = st.text_input("Mobile Loading Speed - GTMetrix:", placeholder='Enter Mobile Loading Speed')
|
| 234 |
self.web_analytics = st.text_input("Web Analytics - BuiltWith (GA4):", placeholder='Enter Web Analytics')
|
| 235 |
self.client_relations_management_system = st.text_input("Client Relations Management System - BuiltWith:", placeholder='Enter Client Relations Management System')
|
| 236 |
+
|
|
|
|
| 237 |
#st.write("") # FOR THE HIDE BUTTON
|
| 238 |
#st.write("") # FOR THE HIDE BUTTON
|
| 239 |
#st.write("AI Analyst Output: ")
|
pages/analyzing_page.py
CHANGED
|
@@ -7,6 +7,9 @@ from classes.response_on_page import SeoOn
|
|
| 7 |
from classes.response_website_and_tools import WebsiteAndTools
|
| 8 |
from classes.response_seo import Seo
|
| 9 |
from classes.response_social_media import SocialMedia
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
def run_analysis():
|
| 12 |
# Placeholders for status updates
|
|
@@ -15,6 +18,9 @@ def run_analysis():
|
|
| 15 |
website_and_tools_status = st.empty()
|
| 16 |
seo_status = st.empty()
|
| 17 |
social_media_status = st.empty()
|
|
|
|
|
|
|
|
|
|
| 18 |
# Function to run SEO Off Page Analysis
|
| 19 |
def run_off_page_analysis():
|
| 20 |
try:
|
|
@@ -65,13 +71,43 @@ def run_analysis():
|
|
| 65 |
except Exception as e:
|
| 66 |
social_media_status.error(f"Social Media Analysis failed: {e}")
|
| 67 |
return None
|
| 68 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
# Create threads for concurrent execution
|
| 70 |
off_page_thread = threading.Thread(target=run_off_page_analysis)
|
| 71 |
on_page_thread = threading.Thread(target=run_on_page_analysis)
|
| 72 |
website_and_tools_thread = threading.Thread(target=run_website_and_tools_analysis)
|
| 73 |
seo_thread = threading.Thread(target=run_seo_analysis)
|
| 74 |
social_media_thread = threading.Thread(target=run_social_media_analysis)
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
# Attach Streamlit context to threads
|
| 77 |
add_script_run_ctx(off_page_thread)
|
|
@@ -79,6 +115,9 @@ def run_analysis():
|
|
| 79 |
add_script_run_ctx(website_and_tools_thread)
|
| 80 |
add_script_run_ctx(seo_thread)
|
| 81 |
add_script_run_ctx(social_media_thread)
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
# Start threads
|
| 84 |
off_page_thread.start()
|
|
@@ -86,6 +125,9 @@ def run_analysis():
|
|
| 86 |
website_and_tools_thread.start()
|
| 87 |
seo_thread.start()
|
| 88 |
social_media_thread.start()
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
# Wait for threads to complete
|
| 91 |
off_page_thread.join()
|
|
@@ -93,7 +135,10 @@ def run_analysis():
|
|
| 93 |
website_and_tools_thread.join()
|
| 94 |
seo_thread.join()
|
| 95 |
social_media_thread.join()
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
| 97 |
st.success("🎉 All analyses completed!") # Final success message
|
| 98 |
# --- Display Button After Completion ---
|
| 99 |
if st.button("View Results"):
|
|
|
|
| 7 |
from classes.response_website_and_tools import WebsiteAndTools
|
| 8 |
from classes.response_seo import Seo
|
| 9 |
from classes.response_social_media import SocialMedia
|
| 10 |
+
from classes.response_lld_pm_ln import LLD_PM_LN
|
| 11 |
+
from classes.response_pull_through_offers import PullThroughOffers
|
| 12 |
+
from classes.response_content import Content
|
| 13 |
|
| 14 |
def run_analysis():
|
| 15 |
# Placeholders for status updates
|
|
|
|
| 18 |
website_and_tools_status = st.empty()
|
| 19 |
seo_status = st.empty()
|
| 20 |
social_media_status = st.empty()
|
| 21 |
+
lld_pm_ln_status = st.empty()
|
| 22 |
+
pull_through_offers_status = st.empty()
|
| 23 |
+
content_status = st.empty()
|
| 24 |
# Function to run SEO Off Page Analysis
|
| 25 |
def run_off_page_analysis():
|
| 26 |
try:
|
|
|
|
| 71 |
except Exception as e:
|
| 72 |
social_media_status.error(f"Social Media Analysis failed: {e}")
|
| 73 |
return None
|
| 74 |
+
def run_lld_pm_ln():
|
| 75 |
+
try:
|
| 76 |
+
lld_pm_ln_status.info("Starting LLD/PM/LN Analysis...")
|
| 77 |
+
result = LLD_PM_LN(os.getenv('Model_LLD_PM_LN_ANALYST'))
|
| 78 |
+
lld_pm_ln_status.success("LLD/PM/LN completed successfully.")
|
| 79 |
+
return result
|
| 80 |
+
except Exception as e:
|
| 81 |
+
lld_pm_ln_status.error(f"LLD/PM/LN Analysis failed: {e}")
|
| 82 |
+
return None
|
| 83 |
+
def run_pull_through_offers():
|
| 84 |
+
try:
|
| 85 |
+
pull_through_offers_status.info("Starting Pull through offer Analysis...")
|
| 86 |
+
result = PullThroughOffers(os.getenv('Model_Pull_Through_Offers_Analyst'))
|
| 87 |
+
pull_through_offers_status.success("Pull through offer completed successfully.")
|
| 88 |
+
return result
|
| 89 |
+
except Exception as e:
|
| 90 |
+
pull_through_offers_status.error(f"Pull through offer Analysis failed: {e}")
|
| 91 |
+
return None
|
| 92 |
+
def run_content():
|
| 93 |
+
try:
|
| 94 |
+
content_status.info("Starting Content Analysis...")
|
| 95 |
+
result = Content(os.getenv('Model_Content'))
|
| 96 |
+
content_status.success("Content Analysis completed successfully.")
|
| 97 |
+
return result
|
| 98 |
+
except Exception as e:
|
| 99 |
+
content_status.error(f"Content Analysis failed: {e}")
|
| 100 |
+
return None
|
| 101 |
+
|
| 102 |
# Create threads for concurrent execution
|
| 103 |
off_page_thread = threading.Thread(target=run_off_page_analysis)
|
| 104 |
on_page_thread = threading.Thread(target=run_on_page_analysis)
|
| 105 |
website_and_tools_thread = threading.Thread(target=run_website_and_tools_analysis)
|
| 106 |
seo_thread = threading.Thread(target=run_seo_analysis)
|
| 107 |
social_media_thread = threading.Thread(target=run_social_media_analysis)
|
| 108 |
+
llm_pm_ln_thread = threading.Thread(target=run_lld_pm_ln)
|
| 109 |
+
pull_through_offers_thread = threading.Thread(target=run_pull_through_offers)
|
| 110 |
+
content_thread = threading.Thread(target=run_content)
|
| 111 |
|
| 112 |
# Attach Streamlit context to threads
|
| 113 |
add_script_run_ctx(off_page_thread)
|
|
|
|
| 115 |
add_script_run_ctx(website_and_tools_thread)
|
| 116 |
add_script_run_ctx(seo_thread)
|
| 117 |
add_script_run_ctx(social_media_thread)
|
| 118 |
+
add_script_run_ctx(llm_pm_ln_thread)
|
| 119 |
+
add_script_run_ctx(pull_through_offers_thread)
|
| 120 |
+
add_script_run_ctx(content_thread)
|
| 121 |
|
| 122 |
# Start threads
|
| 123 |
off_page_thread.start()
|
|
|
|
| 125 |
website_and_tools_thread.start()
|
| 126 |
seo_thread.start()
|
| 127 |
social_media_thread.start()
|
| 128 |
+
llm_pm_ln_thread.start()
|
| 129 |
+
pull_through_offers_thread.start()
|
| 130 |
+
content_thread.start()
|
| 131 |
|
| 132 |
# Wait for threads to complete
|
| 133 |
off_page_thread.join()
|
|
|
|
| 135 |
website_and_tools_thread.join()
|
| 136 |
seo_thread.join()
|
| 137 |
social_media_thread.join()
|
| 138 |
+
llm_pm_ln_thread.join()
|
| 139 |
+
pull_through_offers_thread.join()
|
| 140 |
+
content_thread.join()
|
| 141 |
+
|
| 142 |
st.success("🎉 All analyses completed!") # Final success message
|
| 143 |
# --- Display Button After Completion ---
|
| 144 |
if st.button("View Results"):
|
pages/home.py
CHANGED
|
@@ -13,6 +13,9 @@ from classes.Linkedin import Linkedin
|
|
| 13 |
from classes.Tiktok import Tiktok
|
| 14 |
from classes.website_and_tools import WebsiteAndTools
|
| 15 |
from classes.client_summary import CientSummary
|
|
|
|
|
|
|
|
|
|
| 16 |
import asyncio
|
| 17 |
import time
|
| 18 |
from helper.upload_button import hide_button, unhide_button
|
|
@@ -86,6 +89,9 @@ class DigitalFootprintDashboard:
|
|
| 86 |
#self.crawl = SeoOnCrawl(os.getenv('MODEL_On_Page_Analyst'))
|
| 87 |
self.on_page = SeoOn(os.getenv('MODEL_On_Page_Analyst'))
|
| 88 |
self.website_and_tools = WebsiteAndTools(os.getenv('MODEL_On_Page_Analyst'))
|
|
|
|
|
|
|
|
|
|
| 89 |
|
| 90 |
return col1, col2, col3, col4
|
| 91 |
|
|
|
|
| 13 |
from classes.Tiktok import Tiktok
|
| 14 |
from classes.website_and_tools import WebsiteAndTools
|
| 15 |
from classes.client_summary import CientSummary
|
| 16 |
+
from classes.pull_through_offers import PullThroughOffers
|
| 17 |
+
from classes.lld_pm_ln import LLD_PM_LN
|
| 18 |
+
from classes.content import Content
|
| 19 |
import asyncio
|
| 20 |
import time
|
| 21 |
from helper.upload_button import hide_button, unhide_button
|
|
|
|
| 89 |
#self.crawl = SeoOnCrawl(os.getenv('MODEL_On_Page_Analyst'))
|
| 90 |
self.on_page = SeoOn(os.getenv('MODEL_On_Page_Analyst'))
|
| 91 |
self.website_and_tools = WebsiteAndTools(os.getenv('MODEL_On_Page_Analyst'))
|
| 92 |
+
self.lld_pm_ln = LLD_PM_LN(os.getenv('Model_LLD_PM_LN_ANALYST'))
|
| 93 |
+
self.pull_through_offers = PullThroughOffers(os.getenv('Model_Pull_Through_Offers_Analyst'))
|
| 94 |
+
self.content = Content(os.getenv('Model_Content'))
|
| 95 |
|
| 96 |
return col1, col2, col3, col4
|
| 97 |
|