Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,7 @@ import pandas as pd
|
|
| 2 |
import streamlit as st
|
| 3 |
from langchain.agents import AgentType
|
| 4 |
from langchain_experimental.agents import create_pandas_dataframe_agent
|
| 5 |
-
from
|
| 6 |
|
| 7 |
|
| 8 |
# streamlit web app configuration
|
|
@@ -12,7 +12,8 @@ st.set_page_config(
|
|
| 12 |
layout="centered"
|
| 13 |
)
|
| 14 |
|
| 15 |
-
|
|
|
|
| 16 |
def read_data(file):
|
| 17 |
if file.name.endswith(".csv"):
|
| 18 |
return pd.read_csv(file)
|
|
@@ -54,9 +55,9 @@ if user_prompt:
|
|
| 54 |
# add user's message to chat history and display it
|
| 55 |
st.chat_message("user").markdown(user_prompt)
|
| 56 |
st.session_state.chat_history.append({"role":"user","content": user_prompt})
|
| 57 |
-
|
| 58 |
# loading the LLM
|
| 59 |
-
llm =
|
| 60 |
|
| 61 |
pandas_df_agent = create_pandas_dataframe_agent(
|
| 62 |
llm,
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
from langchain.agents import AgentType
|
| 4 |
from langchain_experimental.agents import create_pandas_dataframe_agent
|
| 5 |
+
from langchain_groq import ChatGroq
|
| 6 |
|
| 7 |
|
| 8 |
# streamlit web app configuration
|
|
|
|
| 12 |
layout="centered"
|
| 13 |
)
|
| 14 |
|
| 15 |
+
with st.sidebar:
|
| 16 |
+
groq_api_key=st.text_input("Groq API Key",value="",type="password")
|
| 17 |
def read_data(file):
|
| 18 |
if file.name.endswith(".csv"):
|
| 19 |
return pd.read_csv(file)
|
|
|
|
| 55 |
# add user's message to chat history and display it
|
| 56 |
st.chat_message("user").markdown(user_prompt)
|
| 57 |
st.session_state.chat_history.append({"role":"user","content": user_prompt})
|
| 58 |
+
|
| 59 |
# loading the LLM
|
| 60 |
+
llm =ChatGroq(model="Gemma-7b-It", groq_api_key=groq_api_key)
|
| 61 |
|
| 62 |
pandas_df_agent = create_pandas_dataframe_agent(
|
| 63 |
llm,
|