Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -18,11 +18,16 @@ os.environ["TOKENIZERS_PARALLELISM"] = "false"
|
|
| 18 |
#OPENAI_API_KEY = ""
|
| 19 |
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY", "")
|
| 20 |
OPENAI_TEMP = 1
|
|
|
|
|
|
|
| 21 |
|
| 22 |
PINECONE_KEY = os.environ.get("PINECONE_KEY", "")
|
| 23 |
PINECONE_ENV = os.environ.get("PINECONE_ENV", "asia-northeast1-gcp")
|
| 24 |
PINECONE_INDEX = os.environ.get("PINECONE_INDEX", "3gpp")
|
| 25 |
|
|
|
|
|
|
|
|
|
|
| 26 |
EMBEDDING_MODEL = os.environ.get("PINECONE_INDEX", "sentence-transformers/all-mpnet-base-v2")
|
| 27 |
|
| 28 |
# return top-k text chunks from vector store
|
|
@@ -55,9 +60,8 @@ KEY_CLEAR = "Clear"
|
|
| 55 |
MODEL_NULL = get_status(STATUS_NOK)
|
| 56 |
MODEL_DONE = get_status(STATUS_OK)
|
| 57 |
|
| 58 |
-
MODEL_WARNING = f"Please paste your OpenAI API Key from \
|
| 59 |
-
[openai.com](https://platform.openai.com/account/api-keys) and then **{KEY_INIT}**"
|
| 60 |
|
|
|
|
| 61 |
|
| 62 |
TAB_1 = "Chatbot"
|
| 63 |
|
|
@@ -74,19 +78,18 @@ DOC_DEFAULT = [DOC_1]
|
|
| 74 |
|
| 75 |
webui_title = """
|
| 76 |
# OpenAI Chatbot Based on Vector Database
|
| 77 |
-
## Example of 3GPP
|
| 78 |
"""
|
| 79 |
|
| 80 |
dup_link = f'''<a href="https://huggingface.co/spaces/ShawnAI/3GPP-ChatBot?duplicate=true">
|
| 81 |
<img src="{get_logo(FORK_BADGE, "addthis")}"></a> '''
|
| 82 |
|
| 83 |
-
init_message = f"""
|
| 84 |
-
|
| 85 |
-
|
|
|
|
| 86 |
"""
|
| 87 |
|
| 88 |
|
| 89 |
-
|
| 90 |
#----------------------------------------------------------------------------------------------------------
|
| 91 |
#----------------------------------------------------------------------------------------------------------
|
| 92 |
|
|
|
|
| 18 |
#OPENAI_API_KEY = ""
|
| 19 |
OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY", "")
|
| 20 |
OPENAI_TEMP = 1
|
| 21 |
+
OPENAI_API_LINK = "[OpenAI API Key](https://platform.openai.com/account/api-keys)"
|
| 22 |
+
OPENAI_LINK = "[OpenAI](https://openai.com)"
|
| 23 |
|
| 24 |
PINECONE_KEY = os.environ.get("PINECONE_KEY", "")
|
| 25 |
PINECONE_ENV = os.environ.get("PINECONE_ENV", "asia-northeast1-gcp")
|
| 26 |
PINECONE_INDEX = os.environ.get("PINECONE_INDEX", "3gpp")
|
| 27 |
|
| 28 |
+
PINECONE_LINK = "[Pinecone](https://www.pinecone.io)"
|
| 29 |
+
LANGCHAIN_LINK = "[LangChain](https://python.langchain.com/en/latest/index.html)"
|
| 30 |
+
|
| 31 |
EMBEDDING_MODEL = os.environ.get("PINECONE_INDEX", "sentence-transformers/all-mpnet-base-v2")
|
| 32 |
|
| 33 |
# return top-k text chunks from vector store
|
|
|
|
| 60 |
MODEL_NULL = get_status(STATUS_NOK)
|
| 61 |
MODEL_DONE = get_status(STATUS_OK)
|
| 62 |
|
|
|
|
|
|
|
| 63 |
|
| 64 |
+
MODEL_WARNING = f"Please paste your **{OPENAI_API_LINK}** and then **{KEY_INIT}**"
|
| 65 |
|
| 66 |
TAB_1 = "Chatbot"
|
| 67 |
|
|
|
|
| 78 |
|
| 79 |
webui_title = """
|
| 80 |
# OpenAI Chatbot Based on Vector Database
|
|
|
|
| 81 |
"""
|
| 82 |
|
| 83 |
dup_link = f'''<a href="https://huggingface.co/spaces/ShawnAI/3GPP-ChatBot?duplicate=true">
|
| 84 |
<img src="{get_logo(FORK_BADGE, "addthis")}"></a> '''
|
| 85 |
|
| 86 |
+
init_message = f"""This demonstration website is based on \
|
| 87 |
+
**{OPENAI_LINK}** with **{LANGCHAIN_LINK}** and **{PINECONE_LINK}**
|
| 88 |
+
1. Insert your **{OPENAI_API_LINK}** and click `{KEY_INIT}`
|
| 89 |
+
2. Insert your **Question** and click `{KEY_SUBMIT}`
|
| 90 |
"""
|
| 91 |
|
| 92 |
|
|
|
|
| 93 |
#----------------------------------------------------------------------------------------------------------
|
| 94 |
#----------------------------------------------------------------------------------------------------------
|
| 95 |
|