Ronio Jerico Roque commited on
Commit ·
5fd0079
1
Parent(s): 373aa66
fix: clean up code and remove commented-out sections
Browse files- classes/Target_Market.py +8 -7
classes/Target_Market.py
CHANGED
|
@@ -10,8 +10,10 @@ from helper.initialize_analyze_session import initialize_analyze_session
|
|
| 10 |
import json
|
| 11 |
from newsapi import NewsApiClient
|
| 12 |
import requests
|
| 13 |
-
from
|
| 14 |
from openai import OpenAI
|
|
|
|
|
|
|
| 15 |
|
| 16 |
class TargetMarketAnalyst:
|
| 17 |
def __init__(self, model_url, analyst_name, data_src, analyst_description):
|
|
@@ -61,6 +63,7 @@ class TargetMarketAnalyst:
|
|
| 61 |
col1, col2 = st.columns(gap="medium", spec=[0.33, 0.66])
|
| 62 |
with col1:
|
| 63 |
prompt = st.chat_input("How can I help you today?")
|
|
|
|
| 64 |
#client = genai.Client(api_key="AIzaSyArNeCctdKaWhxprHTnHyISCd0CpKqB5dk")
|
| 65 |
|
| 66 |
payload_txt = {
|
|
@@ -85,8 +88,7 @@ class TargetMarketAnalyst:
|
|
| 85 |
|
| 86 |
url = "http://172.17.21.23:7860/api/v1/run/382ac239-3231-4f9b-89fe-f5ee26e4b1eb?stream=false"
|
| 87 |
|
| 88 |
-
|
| 89 |
-
|
| 90 |
if prompt:
|
| 91 |
response = requests.post(url, json=payload_txt, headers=headers, params={'stream': 'false'})
|
| 92 |
response.raise_for_status()
|
|
@@ -97,7 +99,7 @@ class TargetMarketAnalyst:
|
|
| 97 |
return text.replace('\\n', '\n').replace('\\t', '\t').replace('\\r', '\r')
|
| 98 |
|
| 99 |
self.text = remove_escape_sequences(json.dumps(text, ensure_ascii=False).strip('"'))
|
| 100 |
-
|
| 101 |
self.topics = st.text_input("Topic of Interest: ", placeholder='Enter Topic of Interest:', key='topic')
|
| 102 |
#self.start_date = st.date_input('Start Date:', value="today", key='start_date')
|
| 103 |
#self.end_date = st.date_input('End Date:', value="today", key='end_date')
|
|
@@ -127,9 +129,8 @@ class TargetMarketAnalyst:
|
|
| 127 |
#st.write("") # FOR THE HIDE BUTTON
|
| 128 |
if prompt:
|
| 129 |
st.write(self.text)
|
| 130 |
-
|
| 131 |
start_time = time.time()
|
| 132 |
-
'''
|
| 133 |
if analyze_button:
|
| 134 |
hide_button()
|
| 135 |
if self.topics:
|
|
@@ -197,7 +198,7 @@ class TargetMarketAnalyst:
|
|
| 197 |
else:
|
| 198 |
st.info("Please provide a topic of interest")
|
| 199 |
hide_button()
|
| 200 |
-
|
| 201 |
if __name__ == "__main__":
|
| 202 |
st.set_page_config(layout="wide")
|
| 203 |
|
|
|
|
| 10 |
import json
|
| 11 |
from newsapi import NewsApiClient
|
| 12 |
import requests
|
| 13 |
+
from requests import sessions
|
| 14 |
from openai import OpenAI
|
| 15 |
+
from pprint import pprint
|
| 16 |
+
from rocketchat_API.rocketchat import RocketChat
|
| 17 |
|
| 18 |
class TargetMarketAnalyst:
|
| 19 |
def __init__(self, model_url, analyst_name, data_src, analyst_description):
|
|
|
|
| 63 |
col1, col2 = st.columns(gap="medium", spec=[0.33, 0.66])
|
| 64 |
with col1:
|
| 65 |
prompt = st.chat_input("How can I help you today?")
|
| 66 |
+
|
| 67 |
#client = genai.Client(api_key="AIzaSyArNeCctdKaWhxprHTnHyISCd0CpKqB5dk")
|
| 68 |
|
| 69 |
payload_txt = {
|
|
|
|
| 88 |
|
| 89 |
url = "http://172.17.21.23:7860/api/v1/run/382ac239-3231-4f9b-89fe-f5ee26e4b1eb?stream=false"
|
| 90 |
|
| 91 |
+
|
|
|
|
| 92 |
if prompt:
|
| 93 |
response = requests.post(url, json=payload_txt, headers=headers, params={'stream': 'false'})
|
| 94 |
response.raise_for_status()
|
|
|
|
| 99 |
return text.replace('\\n', '\n').replace('\\t', '\t').replace('\\r', '\r')
|
| 100 |
|
| 101 |
self.text = remove_escape_sequences(json.dumps(text, ensure_ascii=False).strip('"'))
|
| 102 |
+
'''
|
| 103 |
self.topics = st.text_input("Topic of Interest: ", placeholder='Enter Topic of Interest:', key='topic')
|
| 104 |
#self.start_date = st.date_input('Start Date:', value="today", key='start_date')
|
| 105 |
#self.end_date = st.date_input('End Date:', value="today", key='end_date')
|
|
|
|
| 129 |
#st.write("") # FOR THE HIDE BUTTON
|
| 130 |
if prompt:
|
| 131 |
st.write(self.text)
|
| 132 |
+
'''analyze_button = st.button("", disabled=initialize_analyze_session())
|
| 133 |
start_time = time.time()
|
|
|
|
| 134 |
if analyze_button:
|
| 135 |
hide_button()
|
| 136 |
if self.topics:
|
|
|
|
| 198 |
else:
|
| 199 |
st.info("Please provide a topic of interest")
|
| 200 |
hide_button()
|
| 201 |
+
'''
|
| 202 |
if __name__ == "__main__":
|
| 203 |
st.set_page_config(layout="wide")
|
| 204 |
|