Spaces:
Build error
Build error
Ronio Jerico Roque commited on
Commit ·
38334af
1
Parent(s): 7b96aa1
Refactor payload handling in SeoOffPageAnalyst; update debug information to use combined_text instead of payload_txt
Browse files- classes/Off_Page.py +2 -6
- classes/response_off.py +2 -4
classes/Off_Page.py
CHANGED
|
@@ -75,17 +75,13 @@ class SeoOffPageAnalyst:
|
|
| 75 |
except KeyError:
|
| 76 |
st.info("Incorrect CSV format. Please upload a valid CSV file.")
|
| 77 |
# OUTPUT FOR SEO ANALYST
|
| 78 |
-
|
| 79 |
-
headers = {
|
| 80 |
-
"Content-Type": "application/json",
|
| 81 |
-
"x-api-key": f"{os.getenv('x-api-key')}"
|
| 82 |
-
}
|
| 83 |
#result = self.request_model(payload_txt, headers)
|
| 84 |
|
| 85 |
#end_time = time.time()
|
| 86 |
#time_lapsed = end_time - start_time
|
| 87 |
|
| 88 |
-
debug_info = {'data_field' : 'Backlinks', 'result':
|
| 89 |
#debug_info = {'url_uuid': self.model_url.split("-")[-1],'time_lapsed' : time_lapsed, 'files': [*st.session_state['uploaded_files']],'payload': payload_txt, 'result': result}
|
| 90 |
collect_telemetry(debug_info)
|
| 91 |
|
|
|
|
| 75 |
except KeyError:
|
| 76 |
st.info("Incorrect CSV format. Please upload a valid CSV file.")
|
| 77 |
# OUTPUT FOR SEO ANALYST
|
| 78 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
#result = self.request_model(payload_txt, headers)
|
| 80 |
|
| 81 |
#end_time = time.time()
|
| 82 |
#time_lapsed = end_time - start_time
|
| 83 |
|
| 84 |
+
debug_info = {'data_field' : 'Backlinks', 'result': combined_text}
|
| 85 |
#debug_info = {'url_uuid': self.model_url.split("-")[-1],'time_lapsed' : time_lapsed, 'files': [*st.session_state['uploaded_files']],'payload': payload_txt, 'result': result}
|
| 86 |
collect_telemetry(debug_info)
|
| 87 |
|
classes/response_off.py
CHANGED
|
@@ -9,8 +9,6 @@ from helper.upload_response import upload_response
|
|
| 9 |
from helper.upload_File import uploadFile
|
| 10 |
from helper.button_behaviour import hide_button, unhide_button
|
| 11 |
from helper.initialize_analyze_session import initialize_analyze_session
|
| 12 |
-
import pandas as pd
|
| 13 |
-
import asyncio
|
| 14 |
import json
|
| 15 |
from pymongo import MongoClient
|
| 16 |
from helper.data_field import data_field
|
|
@@ -37,9 +35,10 @@ class SeoOffPageAnalyst:
|
|
| 37 |
response = requests.post(self.model_url, json=payload_txt, headers=headers)
|
| 38 |
response.raise_for_status()
|
| 39 |
output = response.json()
|
|
|
|
| 40 |
text = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]
|
| 41 |
text = json.loads(text)
|
| 42 |
-
|
| 43 |
backlinks = text[0]
|
| 44 |
referring_domains = text[1]
|
| 45 |
|
|
@@ -88,7 +87,6 @@ class SeoOffPageAnalyst:
|
|
| 88 |
|
| 89 |
except Exception as e:
|
| 90 |
pass
|
| 91 |
-
|
| 92 |
if count >= 1:
|
| 93 |
summary = self.fetch_data("Client Summary")
|
| 94 |
self.payload = summary + self.payload
|
|
|
|
| 9 |
from helper.upload_File import uploadFile
|
| 10 |
from helper.button_behaviour import hide_button, unhide_button
|
| 11 |
from helper.initialize_analyze_session import initialize_analyze_session
|
|
|
|
|
|
|
| 12 |
import json
|
| 13 |
from pymongo import MongoClient
|
| 14 |
from helper.data_field import data_field
|
|
|
|
| 35 |
response = requests.post(self.model_url, json=payload_txt, headers=headers)
|
| 36 |
response.raise_for_status()
|
| 37 |
output = response.json()
|
| 38 |
+
#st.write(output)
|
| 39 |
text = output["outputs"][0]["outputs"][0]["results"]["text"]["data"]["text"]
|
| 40 |
text = json.loads(text)
|
| 41 |
+
#st.write(text)
|
| 42 |
backlinks = text[0]
|
| 43 |
referring_domains = text[1]
|
| 44 |
|
|
|
|
| 87 |
|
| 88 |
except Exception as e:
|
| 89 |
pass
|
|
|
|
| 90 |
if count >= 1:
|
| 91 |
summary = self.fetch_data("Client Summary")
|
| 92 |
self.payload = summary + self.payload
|