File size: 5,464 Bytes
f4a091c
 
 
 
cad025d
f4a091c
 
9750294
f4a091c
e08f93f
df0f591
 
 
 
 
f4a091c
 
 
 
 
 
 
 
 
 
 
 
66104a6
 
340532d
66104a6
 
f4a091c
fc0cdf2
f4a091c
fc0cdf2
f4a091c
fc0cdf2
f4a091c
fc0cdf2
f4a091c
 
fc0cdf2
f4a091c
 
fc0cdf2
f4a091c
 
 
 
66104a6
14f2f1a
f4a091c
21a3057
f4a091c
66104a6
 
fc0cdf2
 
21a3057
6797eac
996f9b6
 
 
 
66104a6
 
996f9b6
df39685
c3807de
f4a091c
21a3057
 
 
 
 
a2abe7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21a3057
2d06113
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# -*- coding: utf-8 -*-
"""Copy of Copy of Chatbot with custom knowledge base

Automatically generated by Colaboratory.
#https://bd92eae0f129989aa0.gradio.live/
Original file is located at
    https://colab.research.google.com/drive/1VSXUmag_76fzebs16YhW_as4mdhHNdkx
    #sk-snX9Si8sOuNQf8wX8t0rT3BlbkFJACHD1kpVpVk
"""
The Mega Draw is a quarterly draw held by Warba Bank for AlSunbula account holders. The draw consists of four winners with a prize of KD250,000 for each winner. The draw is held on the Thursday of the second week after each quarter. AlSunbula account holders are required to have a minimum balance of KD100 to be eligible for the draw, and this amount can only be withdrawn upon account closure.
#pip install llama-index
#pip install langchain
#pip install gradio
#pip install pandas 
#pip install openpyxl

import pandas as pd
from llama_index import SimpleDirectoryReader, GPTListIndex, readers, GPTSimpleVectorIndex, LLMPredictor, PromptHelper
from langchain import OpenAI
import sys
import os
from IPython.display import Markdown, display
import pandas as pd
from llama_index import SimpleDirectoryReader, GPTListIndex, readers, GPTSimpleVectorIndex, LLMPredictor, PromptHelper
from langchain import OpenAI
from IPython.display import Markdown, display
import gradio as gr

df = pd.read_excel('Shegardi_dataset.xlsx', sheet_name='dataset')
os.environ['OPENAI_API_KEY'] = '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'


def construct_index(directory_path):
    # set maximum input size
    max_input_size = 4096
    # set number of output tokens
    num_outputs = 2000
    # set maximum chunk overlap
    max_chunk_overlap = 20
    # set chunk size limit
    chunk_size_limit = 600 

    # define LLM
    llm_predictor = LLMPredictor(llm=OpenAI(temperature=0.5, model_name="text-davinci-003", max_tokens=num_outputs))
    prompt_helper = PromptHelper(max_input_size, num_outputs, max_chunk_overlap, chunk_size_limit=chunk_size_limit)
 
    documents = SimpleDirectoryReader(directory_path).load_data()
    index = GPTSimpleVectorIndex(
        documents, llm_predictor=llm_predictor, prompt_helper=prompt_helper
    )
    # Fix for the error message
    index.registry.add_type_to_struct(1, {"answer": str, "question": str})
    index.save_to_disk('index.json')
    return index


# construct_index("context_data/data")

# Include other necessary imports here

def ask_ai(query):
    index = GPTSimpleVectorIndex.load_from_disk('index.json')
    response = index.query(query, response_mode="compact")
    return response.response
    
iface = gr.Interface(fn=ask_ai, inputs="text", outputs="text",
                     title="The following is a conversation with a human called Shegardi. Shegardi is helpful, precise, truthful, and very friendly.  Also, Shegardi is an employee of Warba Bank, located in Kuwait. Shegardi will only use the information provided to him. ",
                     description="Enter a question and get an answer from Shegardi.")

iface.launch()






General Questions about Cards in Warba Bank
To get a credit card:
You can apply for any of the Warba Bank credit cards by applying through the Warba Bank website or you can visit the nearest branch to assist.

The best cash-back card:
Mastercard world is the best cash back world as it provides the best cashback rate and other benefits.

If my salary is 1000 KD, the best card for me would be:
Mastercard world is the best cash back world as it provides the best cashback rate and other benefits.

The deduction date for the credit card:
The credit card deduction date will be based on your salary disbursement date. For example: If you’re an employee in PACI, and your salary was disbursed on 24th of the month, your credit card will be deducted on the same day.

To close the credit card:
You can close your credit card by visiting your nearest Warba bank branch.

Do I have to pay all the due amount to close the card:
You are required to pay all the due amounts on your card in order to close the card.

Taking a clearance certificate without closing my card:
You will need to close your card to get a clearance certificate.

I don't like the feature of my card (visa signature). How can I change it? And what's the 
recommended card for me in this case:
To assist you with the best replacement for your card, you need to visit the nearest Warba Bank branch.

Increase the limit of my card:
You can visit the nearest Warba Bank branch to assist you.

Decrease the limit on my card:
You can visit the nearest Warba Bank branch to assist you with this service.

Delivery of Lost card:
Upon request for a lost card, the delivery courier will contact you for delivery timings.

To know the due amount for my credit card:
-	Log in to your Warba App,
-	Click on the credit card on Warba App that you would like to know the due amount of.
-	You will find the due amounts below the card details.

Re-activate my card without coming to the branch:
If you’re late for the due payment amount for your card, you will have to visit the nearest Warba Bank branch in order to re-activate your card.

Opening a visa card for 15-year-olds:
You can apply for a Visa prepaid card if you are 15 years old.

Minimum age of opening a supplementary account:
The minimum age for opening a supplementary account is 14 years old. 

The credit card replacement fees:
The replacement fees for credit cards are 5 KD for prepaid cards and 15 KD for credit card replacement.