Spaces:
Sleeping
Sleeping
Update modules/utils.py
Browse files- modules/utils.py +6 -6
modules/utils.py
CHANGED
|
@@ -15,13 +15,13 @@ class Utilities:
|
|
| 15 |
"""
|
| 16 |
if os.path.exists(".env") and os.environ.get("OPENAI_API_KEY") is not None:
|
| 17 |
user_api_key = os.environ["OPENAI_API_KEY"]
|
| 18 |
-
st.sidebar.success("API key loaded from .env
|
| 19 |
else:
|
| 20 |
user_api_key = st.sidebar.text_input(
|
| 21 |
-
label="#### Your OpenAI API key / OpenAI API
|
| 22 |
)
|
| 23 |
if user_api_key:
|
| 24 |
-
st.sidebar.success("API key loaded
|
| 25 |
return user_api_key
|
| 26 |
|
| 27 |
@staticmethod
|
|
@@ -41,8 +41,8 @@ class Utilities:
|
|
| 41 |
show_user_file(uploaded_file)
|
| 42 |
else:
|
| 43 |
st.sidebar.info(
|
| 44 |
-
"π Upload your CSV file to get started
|
| 45 |
-
"sample for try :
|
| 46 |
)
|
| 47 |
st.session_state["reset_chat"] = True
|
| 48 |
return uploaded_file
|
|
@@ -53,7 +53,7 @@ class Utilities:
|
|
| 53 |
Sets up the chatbot with the uploaded file, model, and temperature
|
| 54 |
"""
|
| 55 |
embeds = Embedder()
|
| 56 |
-
with st.spinner("Processing...
|
| 57 |
uploaded_file.seek(0)
|
| 58 |
file = uploaded_file.read()
|
| 59 |
vectors = embeds.getDocEmbeds(file, uploaded_file.name)
|
|
|
|
| 15 |
"""
|
| 16 |
if os.path.exists(".env") and os.environ.get("OPENAI_API_KEY") is not None:
|
| 17 |
user_api_key = os.environ["OPENAI_API_KEY"]
|
| 18 |
+
st.sidebar.success("API key loaded from .env ", icon="π")
|
| 19 |
else:
|
| 20 |
user_api_key = st.sidebar.text_input(
|
| 21 |
+
label="#### Your OpenAI API key / OpenAI API π", placeholder="Paste your openAI API key, sk-", type="password"
|
| 22 |
)
|
| 23 |
if user_api_key:
|
| 24 |
+
st.sidebar.success("API key loaded ", icon="π")
|
| 25 |
return user_api_key
|
| 26 |
|
| 27 |
@staticmethod
|
|
|
|
| 41 |
show_user_file(uploaded_file)
|
| 42 |
else:
|
| 43 |
st.sidebar.info(
|
| 44 |
+
"π Upload your CSV file to get started "
|
| 45 |
+
"sample for try : [example.csv](https://drive.google.com/file/d/1g7x0Ydg5kr51Ha2XIYBSQBVUw1yYlgmc/view?usp=share_link)"
|
| 46 |
)
|
| 47 |
st.session_state["reset_chat"] = True
|
| 48 |
return uploaded_file
|
|
|
|
| 53 |
Sets up the chatbot with the uploaded file, model, and temperature
|
| 54 |
"""
|
| 55 |
embeds = Embedder()
|
| 56 |
+
with st.spinner("Processing..."):
|
| 57 |
uploaded_file.seek(0)
|
| 58 |
file = uploaded_file.read()
|
| 59 |
vectors = embeds.getDocEmbeds(file, uploaded_file.name)
|