import streamlit as st import cohere import os import base64 st.set_page_config(page_title="Cohere Chat", layout="wide") AI_PFP = "media/pfps/cohere-pfp.png" USER_PFP = "media/pfps/user-pfp.jpg" BANNER = "media/banner.png" if not os.path.exists(AI_PFP) or not os.path.exists(USER_PFP): st.error("Missing profile pictures in media/pfps directory") st.stop() model_info = { "c4ai-aya-expanse-8b": {"description": "Aya Expanse is a highly performant 8B multilingual model...", "context": "4K", "output": "4K"}, "c4ai-aya-expanse-32b": {"description": "Aya Expanse is a highly performant 32B multilingual model...", "context": "128K", "output": "4K"}, "command-a-03-2025": {"description": "Command A is our most performant model to date...", "context": "256K", "output": "8K"}, "command-r7b-12-2024": {"description": "command-r7b-12-2024 is a small, fast update...", "context": "128K", "output": "4K"}, "command-r-plus-04-2024": {"description": "Command R+ is an instruction-following conversational model...", "context": "128K", "output": "4K"}, "c4ai-aya-vision-8b": {"description": "Aya Vision is an 8B vision-language model...", "context": "4K", "output": "4K"}, "c4ai-aya-vision-32b": {"description": "Aya Vision is a 32B vision-language model...", "context": "128K", "output": "4K"} } with st.sidebar: st.image(BANNER, use_container_width=True) st.markdown("Hugging Face 🤗 Community UI (Vision Model support coming soon)") st.title("Settings") api_key = st.text_input("Cohere API Key", type="password") selected_model = st.selectbox("Model", options=list(model_info.keys())) def clear_chat(): st.session_state.messages = [] st.session_state.first_message_sent = False st.button("Clear Chat", on_click=clear_chat) st.divider() st.image(AI_PFP, width=60) st.subheader(selected_model) st.markdown(model_info[selected_model]["description"]) st.caption(f"Context: {model_info[selected_model]['context']}") st.caption(f"Output: {model_info[selected_model]['output']}") st.markdown("Powered by Cohere's API") if "messages" not in st.session_state: st.session_state.messages = [] if "first_message_sent" not in st.session_state: st.session_state.first_message_sent = False if "uploaded_image" not in st.session_state: st.session_state.uploaded_image = None if not st.session_state.first_message_sent: st.markdown( "