Spaces:
Runtime error
Runtime error
added help tab
Browse files
app.py
CHANGED
@@ -25,39 +25,55 @@ def perform_search(pname, keywords, num_results):
|
|
25 |
rep_txt= generate_kyc_output(query, search_links, resp, start_time)
|
26 |
return (rep_txt)
|
27 |
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
#
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
st.
|
38 |
-
|
39 |
-
st.sidebar.markdown("##
|
40 |
-
st.sidebar.markdown("
|
41 |
-
st.sidebar.
|
42 |
-
st.sidebar.markdown("
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
#
|
48 |
-
if
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
search_results
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
rep_txt= generate_kyc_output(query, search_links, resp, start_time)
|
26 |
return (rep_txt)
|
27 |
|
28 |
+
main_tab, help_tab = st.tabs(["Run the Bot", "Help"])
|
29 |
+
|
30 |
+
with main_tab:
|
31 |
+
# Streamlit app
|
32 |
+
st.title("Adverse News Detection Assistant")
|
33 |
+
|
34 |
+
# Input fields
|
35 |
+
names_txt = st.text_input("Enter party name (or multiple names separated by ,)")
|
36 |
+
plc_text = "laundering OR terrorist OR fraud OR corrupt OR criminal OR investigation OR prosecute OR evasion OR bribe OR sanction"
|
37 |
+
keywords = st.text_input("Enter other search words:", value=plc_text)
|
38 |
+
|
39 |
+
st.sidebar.markdown("## Controls")
|
40 |
+
st.sidebar.markdown("Choose your **search** *parameters*")
|
41 |
+
num_results = st.sidebar.slider("Choose the number of search results:", 5, 30, 20, 5)
|
42 |
+
st.sidebar.markdown("## Model")
|
43 |
+
st.sidebar.markdown("GPT v3.5")
|
44 |
+
st.sidebar.markdown("## App")
|
45 |
+
st.sidebar.markdown("v0.3")
|
46 |
+
|
47 |
+
# Search button
|
48 |
+
if st.button("Search"):
|
49 |
+
names = names_txt.split(",")
|
50 |
+
# Perform the search and display the results
|
51 |
+
if names and keywords:
|
52 |
+
search_results = ""
|
53 |
+
for name in names:
|
54 |
+
#print("trying for name {} \n".format(name))
|
55 |
+
search_results += perform_search(name, keywords, num_results)
|
56 |
+
|
57 |
+
html(f"<pre>{search_results}</pre>", height=200, scrolling=True)
|
58 |
+
st.download_button('Download Report',search_results)
|
59 |
+
try:
|
60 |
+
date_time = datetime.now()
|
61 |
+
save_to_s3(search_results,date_time )
|
62 |
+
print ("Completed processing for {} names: {} at {} \n".format(len(names), names_txt, str(date_time)))
|
63 |
+
except:
|
64 |
+
print ("Completed processing with S3 write error for {} names: {} at {} \n".format(len(names),names_txt, str(date_time)))
|
65 |
+
else:
|
66 |
+
st.error("Please enter your name and search keywords before searching.")
|
67 |
+
|
68 |
+
with help_tab:
|
69 |
+
st.title("FAQ")
|
70 |
+
|
71 |
+
st.markdown("Q. How do I get a count of number of adverse news?")
|
72 |
+
st.markdown("A. This functionality isnt implemented yet. A workaround is to manually count the number of links with adverse news")
|
73 |
+
|
74 |
+
st.markdown("Q. How do I summarise all the adverse news?")
|
75 |
+
st.markdown("A. This functionality isnt implemented yet. A workaround is to aggregate the summary of all adverse news items manually, and get a sumary from ChatGPT (chat.openai.com")
|
76 |
+
|
77 |
+
st.markdown("Q. Can I search in other lauguages?")
|
78 |
+
st.markdown("A. This functionality isnt implemented yet. We are planning to test this feature out with Chinese first")
|
79 |
+
|