advaith2909 commited on
Commit
29b5526
·
verified ·
1 Parent(s): d53a26f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -16,14 +16,18 @@ from textblob import TextBlob
16
  from spacy import displacy
17
  import gradio as gr
18
 
19
- # HuggingFace login
20
- login(token=Gemma)
21
 
22
- # Initialize spaCy model and other NLP tools
23
  nlp = spacy.load("en_core_web_sm")
24
 
25
- # Download the Gemma 2 model
26
- summarizer = pipeline("summarization", model="google/gemma-2-2b-it")
 
 
 
 
27
 
28
  # Text preprocessing
29
  def preprocess_text(text):
 
16
  from spacy import displacy
17
  import gradio as gr
18
 
19
+ # Retrieve the Hugging Face token from environment variables
20
+ hf_token = os.getenv("Gemma")
21
 
22
+ # Initialize spaCy model
23
  nlp = spacy.load("en_core_web_sm")
24
 
25
+ # Initialize the Hugging Face pipeline with authentication
26
+ summarizer = pipeline(
27
+ "summarization",
28
+ model="google/gemma-2-2b-it",
29
+ use_auth_token=hf_token # Use the token for authenticated access
30
+ )
31
 
32
  # Text preprocessing
33
  def preprocess_text(text):