import gradio as gr # from langchain.vectorstores import Chroma ''' https://huggingface.co/spaces/kevinhug/clientX https://hits.seeyoufarm.com/ ''' ''' 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.text.all import * import pathlib p=pathlib.Path('./banks_txt_like.pkl').resolve() ''' NotImplementedError: cannot instantiate ‘WindowsPath’ on your system ''' import platform plt = platform.system() if plt == 'Windows': pathlib.PosixPath = pathlib.WindowsPath else: pathlib.WindowsPath = pathlib.PosixPath learn = load_learner(p) def like(issue): pred,idx,probs = learn.predict(issue) return pred ''' https://www.gradio.app/docs/interface ''' with gr.Blocks() as demo: ''' https://hits.seeyoufarm.com/ https://dash.elfsight.com ''' counter="""
![Visitor Count](https://profile-counter.glitch.me/{YOUR USER}/count.svg) """ # gr.HTML(counter) gr.Markdown("""Enhancing Customer Engagement and Operational Efficiency with NLP ========= 1) Semantic Similarity Document Search (SSDS) 2) Fine Tune LLM #### Data Scientist: Kevin Wong, objectdeveloper@gmail.com, 416-903-7937 ##### Open source ml bank dataset, __I'm just using a small sample of this data set for demo__ https://www.kaggle.com/datasets/trainingdatapro/20000-customers-reviews-on-banks/?select=Banks.csv [![Hits](https://hits.seeyoufarm.com/api/count/incr/badge.svg?url=https%3A%2F%2Fhuggingface.co%2Fspaces%2Fkevinhug%2FclientX&count_bg=%2379C83D&title_bg=%23555555&icon=&icon_color=%23E7E7E7&title=hits&edge_flat=false)](https://hits.seeyoufarm.com) """) with gr.Tab("Semantic Similarity Document Search (SSDS)"): in_similar = gr.Textbox(placeholder="having credit card problem", label="Issue", info="issue you want to explore about" ) out_similar = gr.JSON(label="Similar Verbatim") btn_similar = gr.Button("Find Similar Verbatim") btn_similar.click(fn=similar, inputs=in_similar, outputs=out_similar) gr.Examples( [ ["having credit card problem"], ["low interest credit card"], ["loan"], ["upset customer"], ["what is the password"], ], [in_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. Investment Portfolio Construction/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 - GIC Observability/Cyber Security: ------ Proactive Detection: Identify potential fraud threats and vulnerabilities in real-time. Customer-Centric Approach: Gain insights into customer concerns, allowing us to address them promptly. ### issue: - what is the password 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 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 """) with gr.Accordion("Future Improvement"): gr.Markdown(""" tuning the distance for use case """) with gr.Tab("Fine Tune LLM"): in_like = gr.Textbox(placeholder="having credit card problem" , label="Issue", info="issue you want to explore about") out_like = gr.Textbox(placeholder="like score in range [2 to 248] from fine tuning data", label="like score", info="like score") btn_like = gr.Button("Classify Like Score") btn_like.click(fn=like, inputs=in_like, outputs=out_like) gr.Examples( [ ["having credit card problem"], ["low interest credit card"], ["loan"], ["upset customer"], ["what is the password"], ], [in_like] ) gr.Markdown(""" Smart Insights: Elevating Customer Engagement Through Sentiment Analysis ========= As a Data Scientist with a decades of financial industry experience, I recognize the paramount importance of staying closely tuned to our customer's needs and opinions. In this app, Fine Tune LLM, we have shown how fine-tuning a Language Model (LLM) on a custom dataset can provide valuable insights into customer sentiment across crucial areas such as service, sales, point of failure, product, and emerging trends. Objective: --------- Our aim is to extract meaningful insights from customer interactions to improve our services, products, and overall customer experience. This analysis will help us understand what our customers are discussing and how they feel about different aspects of our business. """) demo.launch()