eikarna commited on
Commit ·
2aecac8
1
Parent(s): d850ee8
Minor Update
Browse files6 unmodified lines7891011121345 unmodified lines5960616263646510 unmodified lines7677787980816 unmodified linesDEFAULT_SYSTEM_PROMPT = """You are a friendly Assistant. Provide clear, accurate, and brief answers.Keep responses polite, engaging, and to the point. If unsure, politely suggest alternatives."""MODEL_NAME = "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B" # Directly specify modelDEVICE = "cuda" if torch.cuda.is_available() else "cpu"# Page configuration45 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"""10 unmodified linesresponse = 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]):6 unmodified lines7891011121345 unmodified lines596061626364656610 unmodified lines77787980818283846 unmodified linesDEFAULT_SYSTEM_PROMPT = """You are a friendly Assistant. Provide clear, accurate, and brief answers.Keep responses polite, engaging, and to the point. If unsure, politely suggest alternatives."""MODEL_NAME = "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B" # Directly specify modelDEVICE = "cuda" if torch.cuda.is_available() else "cpu"# Page configuration45 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"""10 unmodified linesresponse = st.session_state.tokenizer.decode(outputs[0], skip_special_tokens=True)response = response.split("\n</think>\n")[0].strip()response = response.replace("<|User|>", "").strip()response = response.replace("<|System|>", "").strip()return response.split("<|Assistant|>")[-1].strip()def handle_chat_interaction(settings: Dict[str, Any]):
app.py+5-2