Spaces:
Build error
Build error
File size: 3,063 Bytes
fcb4136 99ece80 fcb4136 972a9f4 fcb4136 ba5532a fcb4136 62c16a7 ba5532a fcb4136 ba5532a 0416120 7a42b50 fcb4136 1ba6387 ba5532a fcb4136 1ba6387 99ece80 1ba6387 ba5532a 1ba6387 44f30ad fcb4136 1ba6387 fcb4136 44f30ad 1ba6387 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | import streamlit as st
class Sidebar:
MODEL_OPTIONS = ["gpt-4", "gpt-3.5-turbo"]
TEMPERATURE_MIN_VALUE = 0.0
TEMPERATURE_MAX_VALUE = 1.0
TEMPERATURE_DEFAULT_VALUE = 0.0
TEMPERATURE_STEP = 0.01
@staticmethod
def show_logo(path):
st.sidebar.image(path)
@staticmethod
def about():
about = st.sidebar.expander("About 🤖")
sections = [
"#### ChatBot-CSV is an AI chatbot featuring conversational memory, designed to enable users to discuss their CSV data in a more intuitive manner. 📄",
"#### He employs large language models to provide users with seamless, context-aware natural language interactions for a better understanding of their CSV data. 🌐",
"#### For more information on the differences and specifics between ChatBot and CSVagent, check out the read-me on GitHub 🙌 ",
# "#### Powered by [Langchain](https://github.com/hwchase17/langchain), [OpenAI](https://platform.openai.com/docs/models/gpt-3-5) and [Streamlit](https://github.com/streamlit/streamlit) ⚡",
# "#### Source code : [yvann-hub/ChatBot-CSV](https://github.com/yvann-hub/ChatBot-CSV)",
]
for section in sections:
about.write(section)
@staticmethod
def reset_chat_button():
if st.button("Reset chat"):
st.session_state["reset_chat"] = True
st.session_state.setdefault("reset_chat", False)
def model_selector(self):
model = st.selectbox(label="Model", options=self.MODEL_OPTIONS)
st.session_state["model"] = model
def temperature_slider(self):
temperature = st.slider(
label="Temperature",
min_value=self.TEMPERATURE_MIN_VALUE,
max_value=self.TEMPERATURE_MAX_VALUE,
value=self.TEMPERATURE_DEFAULT_VALUE,
step=self.TEMPERATURE_STEP,
)
st.session_state["temperature"] = temperature
def csv_agent_button(self):
st.session_state.setdefault("show_csv_agent", False)
if st.sidebar.button("CSV Agent"):
st.session_state["show_csv_agent"] = not st.session_state["show_csv_agent"]
def show_options(self):
with st.sidebar.expander("🛠️ Tools", expanded=False):
self.reset_chat_button()
self.csv_agent_button()
self.model_selector()
self.temperature_slider()
st.session_state.setdefault("model", self.MODEL_OPTIONS[0])
st.session_state.setdefault("temperature", self.TEMPERATURE_DEFAULT_VALUE)
""" def csv_agent(self, ):
# Ajout du bouton pour naviguer vers la page du chatbot supplémentaire
if csv_agent_button = st.sidebar.button("CSV Agent"):
query = st.text_input(label="Use CSV agent for precise informations about the csv file itself")
if query != "" :
agent = create_csv_agent(ChatOpenAI(temperature=0), 'poto-associations-sample.csv', verbose=True)
st.write(agent.run(query))""" |