Update app.py
Browse files
app.py
CHANGED
@@ -17,7 +17,7 @@ with st.sidebar:
|
|
17 |
st.markdown("### Instructions 🤖\nThis is a basic chatbot. Ask anything, and the AI will try to help you! The app is supported by Yiqiao Yin.")
|
18 |
|
19 |
# Add a section to ask the user for the response length
|
20 |
-
st.
|
21 |
response_length = st.radio(
|
22 |
"How detailed do you want the response to be?",
|
23 |
('Efficient', 'Medium', 'Academic')
|
@@ -37,8 +37,8 @@ with st.sidebar:
|
|
37 |
st.write(f"Copyright © 2010-{datetime.now().year} Present Yiqiao Yin")
|
38 |
|
39 |
# Initialize session state variables if not already present
|
40 |
-
if "
|
41 |
-
st.session_state["
|
42 |
|
43 |
if "messages" not in st.session_state:
|
44 |
# Adding the initial system message
|
@@ -61,7 +61,7 @@ if prompt := st.chat_input("What is up?"):
|
|
61 |
with st.spinner("The assistant is thinking... Please wait."):
|
62 |
# Create Nvidia completion request with full conversation history
|
63 |
stream = client.chat.completions.create(
|
64 |
-
model=st.session_state["
|
65 |
messages=st.session_state.messages, # Include all previous messages in the API call
|
66 |
temperature=0.5,
|
67 |
top_p=0.7,
|
|
|
17 |
st.markdown("### Instructions 🤖\nThis is a basic chatbot. Ask anything, and the AI will try to help you! The app is supported by Yiqiao Yin.")
|
18 |
|
19 |
# Add a section to ask the user for the response length
|
20 |
+
st.markdown("#### Select the desired length of the AI response:")
|
21 |
response_length = st.radio(
|
22 |
"How detailed do you want the response to be?",
|
23 |
('Efficient', 'Medium', 'Academic')
|
|
|
37 |
st.write(f"Copyright © 2010-{datetime.now().year} Present Yiqiao Yin")
|
38 |
|
39 |
# Initialize session state variables if not already present
|
40 |
+
if "nvidia_model" not in st.session_state:
|
41 |
+
st.session_state["nvidia_model"] = "nvidia/llama-3.1-nemotron-70b-instruct"
|
42 |
|
43 |
if "messages" not in st.session_state:
|
44 |
# Adding the initial system message
|
|
|
61 |
with st.spinner("The assistant is thinking... Please wait."):
|
62 |
# Create Nvidia completion request with full conversation history
|
63 |
stream = client.chat.completions.create(
|
64 |
+
model=st.session_state["nvidia_model"],
|
65 |
messages=st.session_state.messages, # Include all previous messages in the API call
|
66 |
temperature=0.5,
|
67 |
top_p=0.7,
|