Spaces:
Sleeping
Sleeping
Update app.py
Browse filesgroq to original
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,8 +12,7 @@ st.set_page_config(
|
|
| 12 |
layout="centered"
|
| 13 |
)
|
| 14 |
|
| 15 |
-
|
| 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,9 +54,9 @@ if user_prompt:
|
|
| 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 =
|
| 61 |
|
| 62 |
pandas_df_agent = create_pandas_dataframe_agent(
|
| 63 |
llm,
|
|
@@ -80,6 +79,4 @@ if user_prompt:
|
|
| 80 |
|
| 81 |
# display LLM response
|
| 82 |
with st.chat_message("assistant"):
|
| 83 |
-
st.markdown(assistant_response)
|
| 84 |
-
|
| 85 |
-
|
|
|
|
| 2 |
import streamlit as st
|
| 3 |
from langchain.agents import AgentType
|
| 4 |
from langchain_experimental.agents import create_pandas_dataframe_agent
|
| 5 |
+
from langchain_ollama import ChatOllama
|
| 6 |
|
| 7 |
|
| 8 |
# streamlit web app configuration
|
|
|
|
| 12 |
layout="centered"
|
| 13 |
)
|
| 14 |
|
| 15 |
+
|
|
|
|
| 16 |
def read_data(file):
|
| 17 |
if file.name.endswith(".csv"):
|
| 18 |
return pd.read_csv(file)
|
|
|
|
| 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 = ChatOllama(model="gemma:2b", temperature=0)
|
| 60 |
|
| 61 |
pandas_df_agent = create_pandas_dataframe_agent(
|
| 62 |
llm,
|
|
|
|
| 79 |
|
| 80 |
# display LLM response
|
| 81 |
with st.chat_message("assistant"):
|
| 82 |
+
st.markdown(assistant_response)
|
|
|
|
|
|