Spaces:
Running
Running
Update the loading of strings
Browse files- chat_app.py +13 -2
chat_app.py
CHANGED
|
@@ -17,7 +17,18 @@ from global_config import GlobalConfig
|
|
| 17 |
from helpers import llm_helper, pptx_helper
|
| 18 |
|
| 19 |
|
| 20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
DOWNLOAD_FILE_KEY = 'download_file_name'
|
| 22 |
# langchain.debug = True
|
| 23 |
# langchain.verbose = True
|
|
@@ -117,7 +128,7 @@ def set_up_chat_ui():
|
|
| 117 |
placeholder=APP_TEXT['chat_placeholder'],
|
| 118 |
max_chars=GlobalConfig.LLM_MODEL_MAX_INPUT_LENGTH
|
| 119 |
):
|
| 120 |
-
logger.
|
| 121 |
st.chat_message('user').write(prompt)
|
| 122 |
|
| 123 |
progress_bar_pptx = st.progress(0, 'Calling LLM...')
|
|
|
|
| 17 |
from helpers import llm_helper, pptx_helper
|
| 18 |
|
| 19 |
|
| 20 |
+
@st.cache_data
|
| 21 |
+
def _load_strings() -> dict:
|
| 22 |
+
"""
|
| 23 |
+
Load various strings to be displayed in the app.
|
| 24 |
+
:return: The dictionary of strings.
|
| 25 |
+
"""
|
| 26 |
+
|
| 27 |
+
with open(GlobalConfig.APP_STRINGS_FILE, 'r', encoding='utf-8') as in_file:
|
| 28 |
+
return json5.loads(in_file.read())
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
APP_TEXT = _load_strings()
|
| 32 |
DOWNLOAD_FILE_KEY = 'download_file_name'
|
| 33 |
# langchain.debug = True
|
| 34 |
# langchain.verbose = True
|
|
|
|
| 128 |
placeholder=APP_TEXT['chat_placeholder'],
|
| 129 |
max_chars=GlobalConfig.LLM_MODEL_MAX_INPUT_LENGTH
|
| 130 |
):
|
| 131 |
+
logger.info('User input: %s', prompt)
|
| 132 |
st.chat_message('user').write(prompt)
|
| 133 |
|
| 134 |
progress_bar_pptx = st.progress(0, 'Calling LLM...')
|