Spaces:
Sleeping
Sleeping
Added temp and reset buttons.
Browse files23 unmodified lines2425262728293021 unmodified lines5253545556571 unmodified line596061626364656667686938 unmodified lines10810911011111211311423 unmodified lines"Mistral":"mistralai/Mistral-7B-Instruct-v0.2","Gemma-7B":"google/gemma-7b-it","Gemma-2B":"google/gemma-2b-it","Gemma-Zephyr":"HuggingFaceH4/zephyr-7b-gemma-v0.1",# "Llama-2":"meta-llama/Llama-2-7b-chat-hf"}21 unmodified lines}# Define the available modelsmodels =[key for key in model_links.keys()]1 unmodified line# Create the sidebar with the dropdown for model selectionselected_model = st.sidebar.selectbox("Select Model", models)# Create model descriptionst.sidebar.write(f"You're now chatting with **{selected_model}**")st.sidebar.markdown(model_info[selected_model]['description'])st.sidebar.image(model_info[selected_model]['logo'])#Pull in the model we want to userepo_id = model_links[selected_model]38 unmodified lines{"role": m["role"], "content": m["content"]}for m in st.session_state.messages],temperature=0.5,stream=True,max_tokens=3000,)23 unmodified lines2425262728293021 unmodified lines52535455565758596061626364656667686970717273741 unmodified line7677787980818283848586878889909192939438 unmodified lines13313413513613713813923 unmodified lines"Mistral":"mistralai/Mistral-7B-Instruct-v0.2","Gemma-7B":"google/gemma-7b-it","Gemma-2B":"google/gemma-2b-it",# "Gemma-Zephyr":"HuggingFaceH4/zephyr-7b-gemma-v0.1",# "Llama-2":"meta-llama/Llama-2-7b-chat-hf"}21 unmodified lines}def reset_conversation():'''Resets Conversation'''st.session_state.conversation = []st.session_state.messages = []return Noneif "prev_option" not in st.session_state:st.session_state.prev_option = selected_modelif st.session_state.prev_option != selected_model:st.session_state.messages = []st.write(f"Changed to {selected_model}")st.session_state.prev_option = selected_modelreset_conversation()# Define the available modelsmodels =[key for key in model_links.keys()]1 unmodified line# Create the sidebar with the dropdown for model selectionselected_model = st.sidebar.selectbox("Select Model", models)#Create a temperature slidertemp_values = st.sidebar.slider('Select a temperature value', 0.0, 1.0, (0.5))#Add reset button to clear conversationst.sidebar.button('Reset Chat', on_click=reset_conversation) #Reset button# Create model descriptionst.sidebar.write(f"You're now chatting with **{selected_model}**")st.sidebar.markdown(model_info[selected_model]['description'])st.sidebar.image(model_info[selected_model]['logo'])st.sidebar.markdown("*Generated content may be inaccurate or false.*")#Pull in the model we want to userepo_id = model_links[selected_model]38 unmodified lines{"role": m["role"], "content": m["content"]}for m in st.session_state.messages],temperature=temp_values,#0.5,stream=True,max_tokens=3000,)
app.py+28-3