Paul720810 commited on
Commit
7116a8f
·
verified ·
1 Parent(s): 293eddd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -18
app.py CHANGED
@@ -11,22 +11,6 @@ from huggingface_hub import hf_hub_download
11
  from typing import List, Dict, Tuple, Optional
12
  import numpy as np
13
 
14
- from huggingface_hub import HfApi
15
-
16
- api = HfApi()
17
-
18
- # 列出 Hugging Face 免費 serverless (inference endpoint) 已 warm 的模型
19
- models = api.list_models(
20
- filter="text-generation",
21
- inference="warm", # 只要已 warm 的
22
- sort="downloads",
23
- direction=-1,
24
- limit=20
25
- )
26
-
27
- print("🔥 可用的 warm 模型 (前 20):")
28
- for m in models:
29
- print(" -", m.modelId)
30
 
31
 
32
  # ==================== 配置區 ====================
@@ -81,7 +65,7 @@ class TextToSQLSystem:
81
  def __init__(self, model_name='sentence-transformers/paraphrase-multilingual-mpnet-base-v2'):
82
  self.log_history = []
83
  self._log("初始化系統...")
84
- self.schema = self._load_schema()
85
  self.model = SentenceTransformer(model_name, device=DEVICE)
86
  self.dataset, self.corpus_embeddings = self._load_and_encode_dataset()
87
  self._log("✅ 系統初始化完成,已準備就緒。")
@@ -161,7 +145,7 @@ class TextToSQLSystem:
161
  """呼叫 Hugging Face Inference API"""
162
  # === 修正開始 ===
163
  # 確保 API_URL 是一個乾淨的字串,不包含任何 Markdown "[ ]" 或其他特殊字元
164
- API_URL = "https://api-inference.huggingface.co/models/bigscience/bloomz-7b1-mt"
165
 
166
  # === 修正結束 ===
167
 
 
11
  from typing import List, Dict, Tuple, Optional
12
  import numpy as np
13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
 
16
  # ==================== 配置區 ====================
 
65
  def __init__(self, model_name='sentence-transformers/paraphrase-multilingual-mpnet-base-v2'):
66
  self.log_history = []
67
  self._log("初始化系統...")
68
+ self.schema = self._load_schema() # 📌 自動載入 SQLite schema
69
  self.model = SentenceTransformer(model_name, device=DEVICE)
70
  self.dataset, self.corpus_embeddings = self._load_and_encode_dataset()
71
  self._log("✅ 系統初始化完成,已準備就緒。")
 
145
  """呼叫 Hugging Face Inference API"""
146
  # === 修正開始 ===
147
  # 確保 API_URL 是一個乾淨的字串,不包含任何 Markdown "[ ]" 或其他特殊字元
148
+ API_URL = "https://api-inference.huggingface.co/models/Paul720810/qwen2.5-coder-1.5b-sql-finetuned"
149
 
150
  # === 修正結束 ===
151