Spaces:
Runtime error
Runtime error
# -*- coding: utf-8 -*- | |
"""Copy of Copy of Chatbot with custom knowledge base | |
https://drive.google.com/file/d/1GD1MY9e3mojMdzYuGQA-kgLEr_UfJAbO/view?usp=sharing | |
https://teams.microsoft.com/l/chat/0/0?users=28:177cb0c0-2823-4a25-ae66-50fa49984bd6 | |
Automatically generated by Colaboratory. | |
#https://bd92eae0f129989aa0.gradio.live/ | |
Original file is located at | |
https://colab.research.google.com/drive/1VSXUmag_76fzebs16YhW_as4mdhHNdkx | |
#sk-snX9Si8sOuNQf8wX8t0rT3BlbkFJACHD1kpVpVk | |
""" | |
https://warba-qna-bot.azurewebsites.net/ | |
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. | |
if I'm Safwa customer with MasterCard world, I spent 3000 locally and 1000 internationally, calculate my cashback. | |
My salary is kd 3000, recommend a segment for me | |
What is the best service to send money abroad? | |
what is google? | |
انا عميل صفوة وصرفت 3000 برا الكويت و1000 داخل الكويت احسب لي الكاش باك | |
calculate my cashback if i am alsafwa customer and i spent on my mastercard world KD 2000 in milan and KD 1320 in Madrid and KD 5000 in Kuwait? | |
i spend 3000 on my prepaid card and spend 3000 abroad and 1000 in kuwait on my mastercard world, calculate my cashback if i am w segment for both cards and sum it | |
list all the maximum cashback amount for all segments | |
Can i open flexible deposit for 365 days? | |
i spent 3000 on my prepaid card, and spent 3000 abroad and 1000 in kuwait on my mastercard world, calculate my cashback if i am w segment for both cards and sum it | |
############################################################## | |
{ | |
"clientId": "f733f068-2f50-461f-9d5d-61db69183b59", | |
"clientSecret": "1PN8Q~EJMfJQO-dJodlRos8JkwCgLKZp.w0Rsde.", | |
"subscriptionId": "7a89995a-1969-4a82-8e42-6efbdeb02fcb", | |
"tenantId": "b24c718e-a35f-4654-b2fa-501c8126cb37", | |
"activeDirectoryEndpointUrl": "https://login.microsoftonline.com", | |
"resourceManagerEndpointUrl": "https://management.azure.com/", | |
"activeDirectoryGraphResourceId": "https://graph.windows.net/", | |
"sqlManagementEndpointUrl": "https://management.core.windows.net:8443/", | |
"galleryEndpointUrl": "https://gallery.azure.com/", | |
"managementEndpointUrl": "https://management.core.windows.net/" | |
} | |
https://botapp.azurecr.io | |