File size: 1,528 Bytes
fa652ec
 
 
 
 
 
 
 
 
 
5879438
 
 
fa652ec
3fda2a7
 
fa652ec
 
 
 
 
 
5879438
fa652ec
 
 
03997ba
fa652ec
 
03997ba
 
 
 
 
 
fa652ec
 
 
 
 
 
03997ba
fa652ec
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import streamlit as st
import openai 
import sys, getopt
from datetime import datetime

from main import chatgpt_prompt, get_chatgpt_resp, generate_kyc_output, gsearch

# Function to perform the search
# This is a placeholder function, replace it with your actual search implementation
def perform_search(pname, keywords, num_results):
    # record current timestamp
    start_time = datetime.now()
    
    # Google search for the person name and get the first 20 query links 
    query = pname + " " + keywords
    search_links = gsearch(query, num_results)

    # Construct the prompt 
    prompt_text = chatgpt_prompt(pname, search_links)
    #get ChatGPT response 
    resp = get_chatgpt_resp(prompt_text)
    # Create PDF with links and summary 
    rep_txt= generate_kyc_output(query, search_links, resp, start_time)
    return (rep_txt)

# Streamlit app
st.title("KYC Screening Assistant")

# Input fields
name = st.text_input("Enter party name:")
keywords = st.text_input("Enter other search words:")

st.sidebar.markdown("## Controls")
st.sidebar.markdown("Choose your **search** *parameters*")
num_results = st.sidebar.slider("Choose the number of search results:", 5, 30, 20, 5)

# Search button
if st.button("Search"):
    # Perform the search and display the results
    if name and keywords:
        search_results = perform_search(name, keywords, num_results)
        st.download_button('Download Report',search_results)
    else:
        st.error("Please enter your name and search keywords before searching.")