File size: 3,362 Bytes
f1d6020
 
 
 
9a79fc6
0dcf7a4
 
9a79fc6
 
 
 
 
 
f1d6020
a1d18f3
 
 
 
 
 
 
 
839da70
f1d6020
daa55b3
f1d6020
 
a1d18f3
 
 
 
 
 
 
 
9a79fc6
 
 
a1d18f3
 
 
 
 
 
 
 
 
 
736fdc2
a1d18f3
 
839da70
a1d18f3
 
 
 
839da70
a1d18f3
 
 
 
839da70
 
 
 
 
 
 
 
736fdc2
14e9611
 
 
 
 
839da70
 
 
 
736fdc2
14e9611
 
839da70
 
 
 
 
736fdc2
14e9611
736fdc2
a1d18f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29221b5
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
import gradio as gr
# from langchain.vectorstores import Chroma


'''
https://huggingface.co/spaces/kevinhug/clientX

https://dash.elfsight.com
'''
counter="""
<script src="https://static.elfsight.com/platform/platform.js" data-use-service-core defer></script>
<div class="elfsight-app-5f3e8eb9-9103-490e-9999-e20aa4157dc7" data-elfsight-app-lazy></div>
"""

'''
SIMILAR VECTOR DB SEARCH
'''
import chromadb
client = chromadb.PersistentClient(path="chroma.db")

db = client.get_collection(name="banks")

def similar(issue):
  global db
  docs = db.query(query_texts=issue, n_results=5)
  return docs

'''
FINE TUNE LLM LIKE SCORE
'''
from fastai.vision.all import *
learn = load_learner('banks_txt_like.pkl')
def like(issue):
  pred,idx,probs = learn.predict(issue)
  return pred
'''
https://www.gradio.app/docs/interface
'''




with gr.Blocks() as demo:
  gr.Markdown("""Enhancing Customer Engagement and Operational Efficiency with NLP
  =========
  LLM
  Semantic Similarity Document Search (SSDS)
  
  Data Scientist: Kevin Wong, [email protected], 416-903-7937

  Open source ml bank dataset
https://www.kaggle.com/datasets/trainingdatapro/20000-customers-reviews-on-banks/?select=Banks.csv
  """)
  with gr.Tab("Semantic Similarity Document Search (SSDS)"):
    in_similar = gr.Textbox(placeholder="having credit card problem")
    out_similar = gr.JSON()

    btn_similar = gr.Button("Find Similar Verbatim")
    btn_similar.click(fn=similar, inputs=in_similar, outputs=out_similar)

    gr.Markdown("""
Description:
=======
In today's dynamic financial landscape, the Semantic Similarity Document Search (SSDS) capability is a practical innovation to improve client experience, marketing leads, and sentiment analysis. As a Data Scientist with a decades in the financial industry, I see the value of SSDS in action.

Client Experience:
------
When a client faces a bad experience, SSDS helps us swiftly locate relevant documents to understand and address their concerns, be it credit card issues, late payment fees, or credit score drops.

### issue:
  - having bad client experience
  - having credit card problem
  - late payment fee
  - credit score dropping
  
Marketing Leads:
------
To enhance marketing strategies, SSDS identifies market trends and consumer preferences, such as the demand for low-interest credit cards. It's a treasure trove for refining our product offerings.

### issue:
  - low interest credit card
  
Sentiments:
------
SSDS tracks customer sentiment, empowering us to swiftly respond to upset customers. It ensures we address their issues promptly, enhancing trust and loyalty.
With no need for jargon, SSDS delivers tangible value to our fintech operations. It's about staying agile, informed, and customer-centric in a rapidly changing financial world.

### issue:   
  - upset customer
  
Using Sentence Embedding to inject Public ML Banks Text Dataset @ https://github.com/kevinwkc/analytics/blob/master/ai/vectorDB.py
    """)

  with gr.Tab("Fine Tune LLM")
    in_like = gr.Textbox(placeholder="having credit card problem")
    out_like = gr.Textbox(placeholder="like score")

    btn_like = gr.Button("Find Like Score")
    btn_like.click(fn=like, inputs=in_like, outputs=out_like)


  with gr.Accordion("Future Improvement"):
    gr.Markdown("""
  tuning the distance for use case
    """)

demo.launch()