MrSimple07 commited on
Commit
8a4fdd4
Β·
1 Parent(s): 324e084

added python_version to readme.md

Browse files
Files changed (3) hide show
  1. readme.md +1 -0
  2. requirements.txt +1 -2
  3. scripts/config.py +19 -0
readme.md CHANGED
@@ -5,6 +5,7 @@ colorFrom: yellow
5
  colorTo: green
6
  sdk: gradio
7
  sdk_version: 5.42.0
 
8
  app_file: app.py
9
  pinned: false
10
  ---
 
5
  colorTo: green
6
  sdk: gradio
7
  sdk_version: 5.42.0
8
+ python_version: 3.12.0
9
  app_file: app.py
10
  pinned: false
11
  ---
requirements.txt CHANGED
@@ -8,5 +8,4 @@ PyPDF2
8
  python-docx
9
  openpyxl
10
  sentence-transformers
11
- google-generativeai
12
- huggingface_hub
 
8
  python-docx
9
  openpyxl
10
  sentence-transformers
11
+ google-generativeai
 
scripts/config.py CHANGED
@@ -6,6 +6,8 @@ from llama_index.core import Settings
6
  from llama_index.core.llms import ChatMessage, MessageRole
7
  import os
8
  from huggingface_hub import hf_hub_download
 
 
9
 
10
 
11
  # Configuration
@@ -30,6 +32,23 @@ MIN_CHUNK_SIZE = 750
30
  SIMILARITY_THRESHOLD = 0.7
31
 
32
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  def download_pretrained_files():
34
  """Download pre-trained RAG files from HuggingFace Hub"""
35
  try:
 
6
  from llama_index.core.llms import ChatMessage, MessageRole
7
  import os
8
  from huggingface_hub import hf_hub_download
9
+ from huggingface_hub import HfApi, login, create_repo
10
+
11
 
12
 
13
  # Configuration
 
32
  SIMILARITY_THRESHOLD = 0.7
33
 
34
 
35
+ def login_to_huggingface():
36
+ """Login to HuggingFace Hub"""
37
+ try:
38
+ if HF_TOKEN:
39
+ login(token=HF_TOKEN)
40
+ print("βœ… Successfully logged in to HuggingFace Hub with token")
41
+ return True
42
+ else:
43
+ # Interactive login if no token provided
44
+ login()
45
+ print("βœ… Successfully logged in to HuggingFace Hub")
46
+ return True
47
+ except Exception as e:
48
+ print(f"❌ Failed to login to HuggingFace Hub: {e}")
49
+ return False
50
+
51
+
52
  def download_pretrained_files():
53
  """Download pre-trained RAG files from HuggingFace Hub"""
54
  try: