Spaces:
Sleeping
Sleeping
chen commited on
Update config.py
Browse files14 unmodified lines15161718192021222324251 unmodified line2728293031323334353637383940414243444514 unmodified lines# --- Hugging Face Space URL ---HF_SPACE_URL = os.getenv("SPACEURL")if not HF_SPACE_URL:sid = os.getenv("SPACE_ID")if sid and "/" in sid:author, name = sid.split("/", 1)HF_SPACE_URL = f"https://{author.replace('_', '-')}-{name.replace('_', '-')}.hf.space"else:HF_SPACE_URL = ""1 unmodified lineSTATIC_DIR = os.getenv("STATIC_DIR", os.path.join(tempfile.gettempdir(), "static"))os.makedirs(STATIC_DIR, exist_ok=True)# --- API 端點 ---CWA_ALARM_API = "https://app-2.cwa.gov.tw/api/v1/earthquake/alarm/list"USGS_API_BASE_URL = "https://earthquake.usgs.gov/fdsnws/event/1/query"# --- AI 模型設定 ---HUGGING_FACE_TOKEN = os.getenv("HUGGING_FACE_TOKEN")# [修改] 將模型更換為指令微調過的 bloomz-560mLLM_MODEL = os.getenv("LLM_MODEL", "bigscience/bloomz-560m")LLM_MAX_NEW_TOKENS = int(os.getenv("LLM_MAX_NEW_TOKENS", "120"))LLM_TOP_K = int(os.getenv("LLM_TOP_K", "50"))LLM_TEMPERATURE = float(os.getenv("LLM_TEMPERATURE", "0.7"))# --- 顯示用當年年份 ---CURRENT_YEAR = datetime.now().year14 unmodified lines151617181920211 unmodified line232425262728293031323314 unmodified lines# --- Hugging Face Space URL ---HF_SPACE_URL = os.getenv("SPACEURL")# ... (中間部分程式碼不變) ...else:HF_SPACE_URL = ""1 unmodified lineSTATIC_DIR = os.getenv("STATIC_DIR", os.path.join(tempfile.gettempdir(), "static"))os.makedirs(STATIC_DIR, exist_ok=True)# --- API 端點與金鑰 ---CWA_AUTH_KEY = os.getenv("CWA_AUTH_KEY") # [新增] 從環境變數讀取 CWA 金鑰CWA_ALARM_API = "https://app-2.cwa.gov.tw/api/v1/earthquake/alarm/list"USGS_API_BASE_URL = "https://earthquake.usgs.gov/fdsnws/event/1/query"# --- AI 模型設定 ---HUGGING_FACE_TOKEN = os.getenv("HUGGING_FACE_TOKEN")# ... (以下程式碼不變) ...
config.py+4-16