Spaces:
Runtime error
Runtime error
exec time
Browse files
app.py
CHANGED
@@ -8,6 +8,9 @@ from main import chatgpt_prompt, get_chatgpt_resp, generate_kyc_output, gsearch
|
|
8 |
# Function to perform the search
|
9 |
# This is a placeholder function, replace it with your actual search implementation
|
10 |
def perform_search(pname, keywords, num_results):
|
|
|
|
|
|
|
11 |
# Google search for the person name and get the first 20 query links
|
12 |
query = pname + " " + keywords
|
13 |
search_links = gsearch(query, num_results)
|
@@ -17,7 +20,7 @@ def perform_search(pname, keywords, num_results):
|
|
17 |
#get ChatGPT response
|
18 |
resp = get_chatgpt_resp(prompt_text)
|
19 |
# Create PDF with links and summary
|
20 |
-
rep_txt= generate_kyc_output(
|
21 |
return (rep_txt)
|
22 |
|
23 |
# Streamlit app
|
|
|
8 |
# Function to perform the search
|
9 |
# This is a placeholder function, replace it with your actual search implementation
|
10 |
def perform_search(pname, keywords, num_results):
|
11 |
+
# record current timestamp
|
12 |
+
start_time = datetime.now()
|
13 |
+
|
14 |
# Google search for the person name and get the first 20 query links
|
15 |
query = pname + " " + keywords
|
16 |
search_links = gsearch(query, num_results)
|
|
|
20 |
#get ChatGPT response
|
21 |
resp = get_chatgpt_resp(prompt_text)
|
22 |
# Create PDF with links and summary
|
23 |
+
rep_txt= generate_kyc_output(query, search_links, resp, start_time)
|
24 |
return (rep_txt)
|
25 |
|
26 |
# Streamlit app
|
main.py
CHANGED
@@ -39,10 +39,10 @@ def chatgpt_prompt(pname, search_links):
|
|
39 |
news (Yes or No)".format(pname, all_links)
|
40 |
return(prompt_text)
|
41 |
|
42 |
-
def generate_kyc_output(
|
43 |
rep_txt = ''
|
44 |
|
45 |
-
rep_txt += 'Summary of Google Search for {} \n'.format(
|
46 |
rep_txt += '\n'
|
47 |
rep_txt += "Report generated on {} \n".format(datetime.now())
|
48 |
#rep_txt += "----------------------------------------------------- \n"
|
@@ -55,6 +55,12 @@ def generate_kyc_output(pname, search_links, chat_response):
|
|
55 |
rep_txt+= "\n Summary of searches and adverse news findings \n"
|
56 |
#rep_txt += "----------------------------------------------------- \n"
|
57 |
rep_txt += chat_response
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
|
59 |
return(rep_txt)
|
60 |
|
@@ -80,9 +86,9 @@ def main(argv):
|
|
80 |
resp = get_chatgpt_resp(prompt_text)
|
81 |
|
82 |
# Create PDF with links and summary
|
83 |
-
rep_txt= generate_kyc_output(pname, search_links, resp)
|
84 |
|
85 |
-
print(rep_txt)
|
86 |
|
87 |
|
88 |
if __name__ == "__main__":
|
|
|
39 |
news (Yes or No)".format(pname, all_links)
|
40 |
return(prompt_text)
|
41 |
|
42 |
+
def generate_kyc_output(query, search_links, chat_response, start_time):
|
43 |
rep_txt = ''
|
44 |
|
45 |
+
rep_txt += 'Summary of Google Search for {} \n'.format(query)
|
46 |
rep_txt += '\n'
|
47 |
rep_txt += "Report generated on {} \n".format(datetime.now())
|
48 |
#rep_txt += "----------------------------------------------------- \n"
|
|
|
55 |
rep_txt+= "\n Summary of searches and adverse news findings \n"
|
56 |
#rep_txt += "----------------------------------------------------- \n"
|
57 |
rep_txt += chat_response
|
58 |
+
rep_txt += '\n'
|
59 |
+
|
60 |
+
end_time = datetime.now()
|
61 |
+
exec_time = (end_time - start_time).total_seconds()
|
62 |
+
rep_txt += "Execution runtime {} seconds \n".format(exec_time)
|
63 |
+
rep_txt += '\n'
|
64 |
|
65 |
return(rep_txt)
|
66 |
|
|
|
86 |
resp = get_chatgpt_resp(prompt_text)
|
87 |
|
88 |
# Create PDF with links and summary
|
89 |
+
#rep_txt= generate_kyc_output(pname, search_links, resp)
|
90 |
|
91 |
+
#print(rep_txt)
|
92 |
|
93 |
|
94 |
if __name__ == "__main__":
|