gnaw05 commited on
Commit
8d69bdb
·
verified ·
1 Parent(s): 193044f
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -6,6 +6,7 @@ import docx2txt
6
  from sklearn.feature_extraction.text import TfidfVectorizer
7
  from sklearn.metrics.pairwise import cosine_similarity
8
  import difflib
 
9
  from huggingface_hub import InferenceClient # Import Hugging Face API
10
 
11
  # ========== CONFIG ==========
@@ -13,10 +14,12 @@ st.set_page_config(page_title="📑 Contract Analyzer", layout="wide")
13
 
14
  # ========== FUNCTIONS ==========
15
 
 
 
16
  # Tải mô hình Hugging Face từ Hub
17
  def load_inference_client():
18
  try:
19
- return InferenceClient("HuggingFaceH4/zephyr-7b-beta")
20
  except Exception as e:
21
  st.error(f"Error loading InferenceClient: {e}")
22
  return None
 
6
  from sklearn.feature_extraction.text import TfidfVectorizer
7
  from sklearn.metrics.pairwise import cosine_similarity
8
  import difflib
9
+ import os
10
  from huggingface_hub import InferenceClient # Import Hugging Face API
11
 
12
  # ========== CONFIG ==========
 
14
 
15
  # ========== FUNCTIONS ==========
16
 
17
+
18
+ token = os.environ.get("HF_TOKEN")
19
  # Tải mô hình Hugging Face từ Hub
20
  def load_inference_client():
21
  try:
22
+ return InferenceClient("HuggingFaceH4/zephyr-7b-beta", token)
23
  except Exception as e:
24
  st.error(f"Error loading InferenceClient: {e}")
25
  return None