MilanCalegari commited on
Commit
519e734
·
1 Parent(s): fe1d98b

fix: add login in hugging space

Browse files
Files changed (1) hide show
  1. modules/llm/card_interpreter.py +5 -0
modules/llm/card_interpreter.py CHANGED
@@ -1,5 +1,7 @@
 
1
  from typing import Dict, List, Optional
2
 
 
3
  from transformers import pipeline
4
 
5
  from modules.utils.commom import Card, CardReadingMethod
@@ -9,6 +11,9 @@ from ..interfaces.llm_interface import CardInterpreterInterface
9
 
10
  class CardInterpreter(CardInterpreterInterface):
11
  def __init__(self) -> None:
 
 
 
12
  # Initialize pipeline once and cache it
13
  self.pipeline = pipeline(
14
  "text-generation",
 
1
+ import os
2
  from typing import Dict, List, Optional
3
 
4
+ from huggingface_hub import login
5
  from transformers import pipeline
6
 
7
  from modules.utils.commom import Card, CardReadingMethod
 
11
 
12
  class CardInterpreter(CardInterpreterInterface):
13
  def __init__(self) -> None:
14
+ # Login to Hugging Face
15
+ hf_token = os.getenv("HF_TOKEN")
16
+ login(token=hf_token)
17
  # Initialize pipeline once and cache it
18
  self.pipeline = pipeline(
19
  "text-generation",