eikarna commited on
Commit ·
d850ee8
1
Parent(s): 971fbd1
Major Update
Browse files58 unmodified lines5960616263646566679 unmodified lines7778798081828330 unmodified lines11411511611711811912058 unmodified linesdef format_prompt(system_message: str, user_input: str) -> str:"""Format prompt according to model's required template"""return f"""<|begin▁of▁sentence|>System: {system_message}User: {user_input}Assistant: """def generate_response(prompt: str, settings: Dict[str, Any]) -> str:"""Generate response using local model"""9 unmodified lines)response = st.session_state.tokenizer.decode(outputs[0], skip_special_tokens=True)return response.split("Assistant:")[-1].strip()def handle_chat_interaction(settings: Dict[str, Any]):"""Manage chat interactions"""30 unmodified linesload_model() # Load model before anything elsesettings = configure_sidebar()st.title("🤖 DeepSeek Chatbot (Local)")st.caption(f"Running {MODEL_NAME} directly on {DEVICE.upper()}")display_chat_history()58 unmodified lines596061626364659 unmodified lines757677787980818230 unmodified lines11311411511611711811958 unmodified linesdef format_prompt(system_message: str, user_input: str) -> str:"""Format prompt according to model's required template"""return f"""<|begin_of_sentence|>System: {system_message}<|User|>{user_input}<|Assistant|>"""def generate_response(prompt: str, settings: Dict[str, Any]) -> str:"""Generate response using local model"""9 unmodified lines)response = st.session_state.tokenizer.decode(outputs[0], skip_special_tokens=True)response = response.split("\n</think>\n")[0].strip()return response.split("<|Assistant|>")[-1].strip()def handle_chat_interaction(settings: Dict[str, Any]):"""Manage chat interactions"""30 unmodified linesload_model() # Load model before anything elsesettings = configure_sidebar()st.title("🤖 DeepSeek Chat")st.caption(f"Running {MODEL_NAME} directly on {DEVICE.upper()}")display_chat_history()
app.py+4-5