"""Configuration for the Ryugaku Gradio app.""" import os # --------------------------------------------------------------------------- # Model paths # --------------------------------------------------------------------------- # HF Hub repo id for the fine-tuned Japanese -> English translation model. HF_MODEL_ID = os.environ.get( "RYUGAKU_MODEL_ID", "build-small-hackathon/ryugaku-jaen-translator-4b", ) # Local fallback path for development / offline testing. LEGACY_MODEL_PATH = os.environ.get( "RYUGAKU_LOCAL_MODEL", "/mnt/github/Ryugaku/legacy_backup/LLM/outputs_qwen35_jaen/merged_16bit", ) # Device / dtype overrides. FORCE_CPU = os.environ.get("RYUGAKU_FORCE_CPU", "0") == "1" DTYPE = os.environ.get("RYUGAKU_DTYPE", "bfloat16") # --------------------------------------------------------------------------- # Generation defaults # --------------------------------------------------------------------------- DEFAULT_MAX_NEW_TOKENS = int(os.environ.get("RYUGAKU_MAX_NEW_TOKENS", "512")) DEFAULT_TEMPERATURE = float(os.environ.get("RYUGAKU_TEMPERATURE", "0.1")) # --------------------------------------------------------------------------- # System prompts # --------------------------------------------------------------------------- TRANSLATION_SYSTEM_PROMPT = ( "You are a precise Japanese-to-English translator. " "Translate the user's Japanese text into natural English only. " "Do not add explanations, notes, or romanizations." ) SUMMARY_SYSTEM_PROMPT = ( "You are an assistant for international students in Japan. " "Summarize the following Japanese text in clear English. " "Use bullet points when appropriate. Keep it concise." ) EASY_ENGLISH_SYSTEM_PROMPT = ( "You are an English language assistant for international students. " "Rewrite the following English text into simple, easy-to-understand English. " "Use short sentences and common words. Keep the meaning the same." ) KEYWORD_SYSTEM_PROMPT = ( "You are a Japanese language learning assistant. " "Extract 5 to 10 important Japanese vocabulary words from the text. " "List each word on its own line in this exact format:\n" "word (reading) — meaning\n" "Do not add introductions, explanations, or numbering." ) EXAM_SYSTEM_PROMPT = ( "You are an academic assistant for international students in Japan. " "Based on the lecture text, predict 3 to 5 likely exam questions. " "List each prediction on its own block in this exact format:\n" "Topic: \nQuestion: \nAnswer: \n\n" "Do not add introductions or explanations." ) OCR_SYSTEM_PROMPT = ( "You are a translation helper for international students. " "The user has uploaded an image of Japanese text. Translate it into English. " "If the text is unclear, say so briefly." )