Spaces:
Sleeping
Sleeping
IvanLayer7
commited on
Commit
路
49654de
1
Parent(s):
6863eab
Upload 8 files
Browse files- .gitattributes +1 -0
- app.py +61 -0
- chroma_db/03dd0657-e6b1-42ff-9683-5a27acb1c13c/data_level0.bin +3 -0
- chroma_db/03dd0657-e6b1-42ff-9683-5a27acb1c13c/header.bin +3 -0
- chroma_db/03dd0657-e6b1-42ff-9683-5a27acb1c13c/index_metadata.pickle +3 -0
- chroma_db/03dd0657-e6b1-42ff-9683-5a27acb1c13c/length.bin +3 -0
- chroma_db/03dd0657-e6b1-42ff-9683-5a27acb1c13c/link_lists.bin +3 -0
- chroma_db/chroma.sqlite3 +3 -0
- requirements.txt +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
chroma_db/chroma.sqlite3 filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import openai
|
2 |
+
import gradio as gr
|
3 |
+
from langchain.llms import OpenAI
|
4 |
+
import os
|
5 |
+
import openai
|
6 |
+
import csv
|
7 |
+
from openai import OpenAI
|
8 |
+
from langchain.chat_models import ChatOpenAI
|
9 |
+
from langchain.llms import OpenAI
|
10 |
+
from langchain.embeddings import OpenAIEmbeddings
|
11 |
+
from langchain.vectorstores import Chroma
|
12 |
+
from langchain.memory import ConversationSummaryMemory
|
13 |
+
from langchain.chains import ConversationalRetrievalChain
|
14 |
+
from langchain.chat_models import ChatOpenAI
|
15 |
+
from dotenv import load_dotenv, find_dotenv
|
16 |
+
|
17 |
+
_ = load_dotenv(find_dotenv()) # read local .env file
|
18 |
+
|
19 |
+
# Read VectorStore
|
20 |
+
vectorstore = Chroma(
|
21 |
+
embedding_function=OpenAIEmbeddings(),
|
22 |
+
persist_directory="chroma_db"
|
23 |
+
)
|
24 |
+
|
25 |
+
# Memory
|
26 |
+
llm_memory = OpenAI(temperature=0.0)
|
27 |
+
memory = ConversationSummaryMemory(
|
28 |
+
llm=llm_memory, memory_key="chat_history", return_messages=True
|
29 |
+
)
|
30 |
+
|
31 |
+
# Chabot QA
|
32 |
+
llm_qa = ChatOpenAI(temperature=0.0)
|
33 |
+
retriever = vectorstore.as_retriever()
|
34 |
+
qa = ConversationalRetrievalChain.from_llm(
|
35 |
+
llm_qa,
|
36 |
+
retriever=retriever,
|
37 |
+
memory=memory
|
38 |
+
)
|
39 |
+
|
40 |
+
|
41 |
+
def chatbot(message, history):
|
42 |
+
response = qa(message)
|
43 |
+
return response["answer"]
|
44 |
+
|
45 |
+
iface = gr.ChatInterface(
|
46 |
+
fn=chatbot,
|
47 |
+
title="馃 AI Bot for Help Center in CCC.uno 馃摓",
|
48 |
+
examples = [
|
49 |
+
"Qui茅n eres?",
|
50 |
+
"Qu茅 es Press 3?",
|
51 |
+
"C贸mo puedo usar Secure Screen?"
|
52 |
+
"C贸mo puedo obtener reportes de IVR?",
|
53 |
+
"Por que se queda procesando en Take Calls?",
|
54 |
+
|
55 |
+
],
|
56 |
+
description="A chatbot for CCC.uno Support <br> Ask whatever you want related to CCC.uno <br> Knowledge base from: https://help.ccc.uno/es/"
|
57 |
+
)
|
58 |
+
|
59 |
+
|
60 |
+
if __name__ == "__main__":
|
61 |
+
iface.launch()
|
chroma_db/03dd0657-e6b1-42ff-9683-5a27acb1c13c/data_level0.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:5bfcac5c4513c91784fd167c9c18be5b22bd3e30842b063297ebca9833ea8132
|
3 |
+
size 18852000
|
chroma_db/03dd0657-e6b1-42ff-9683-5a27acb1c13c/header.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6c6783807f9c22203a562f0446296e3f0763c0233319a19332d58ed0445ce237
|
3 |
+
size 100
|
chroma_db/03dd0657-e6b1-42ff-9683-5a27acb1c13c/index_metadata.pickle
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6c5f95ee44301b6fff5dd315f7e8ac5d8f9309963c4483b47dc0bc9827beed3d
|
3 |
+
size 172004
|
chroma_db/03dd0657-e6b1-42ff-9683-5a27acb1c13c/length.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:201a34da9df2b1db568f03fc5cfb4fba1c8d7567207638166186ea38d57e14b5
|
3 |
+
size 12000
|
chroma_db/03dd0657-e6b1-42ff-9683-5a27acb1c13c/link_lists.bin
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:34bc2a65fae4e2590bd56373112f0eb6daa6247249a3653b9d782d4f01559365
|
3 |
+
size 25192
|
chroma_db/chroma.sqlite3
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:74e818e1420ed35f58333a9027d20c472e5b0051bb32271cdd9f27245e3d3979
|
3 |
+
size 70512640
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
openai
|
2 |
+
langchain
|
3 |
+
dotenv
|