Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,14 +16,18 @@ from textblob import TextBlob
|
|
| 16 |
from spacy import displacy
|
| 17 |
import gradio as gr
|
| 18 |
|
| 19 |
-
#
|
| 20 |
-
|
| 21 |
|
| 22 |
-
# Initialize spaCy model
|
| 23 |
nlp = spacy.load("en_core_web_sm")
|
| 24 |
|
| 25 |
-
#
|
| 26 |
-
summarizer = pipeline(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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):
|