Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,10 +14,12 @@ import requests
|
|
14 |
from transformers import pipeline
|
15 |
|
16 |
# Initialize Hugging Face Summarization and Text Generation Pipelines
|
17 |
-
summarizer = pipeline("summarization", model="scieditor/citation-generation-t5")
|
18 |
-
citation_generator = pipeline("text-generation", model="gpt2")
|
19 |
|
20 |
-
from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
|
|
|
|
21 |
|
22 |
def search_related_articles_crossref(query, max_results=3):
|
23 |
"""Search for related articles using CrossRef API."""
|
@@ -62,8 +64,8 @@ def extract_text_from_html(url):
|
|
62 |
except Exception as e:
|
63 |
return f"Error extracting text: {str(e)}"
|
64 |
|
65 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
66 |
-
model =
|
67 |
|
68 |
def summarize_article(article_text):
|
69 |
"""Summarize a given article's text."""
|
|
|
14 |
from transformers import pipeline
|
15 |
|
16 |
# Initialize Hugging Face Summarization and Text Generation Pipelines
|
17 |
+
# summarizer = pipeline("summarization", model="scieditor/citation-generation-t5")
|
18 |
+
# citation_generator = pipeline("text-generation", model="gpt2")
|
19 |
|
20 |
+
# from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
|
21 |
+
|
22 |
+
from transformers import AutoTokenizer, PegasusModel
|
23 |
|
24 |
def search_related_articles_crossref(query, max_results=3):
|
25 |
"""Search for related articles using CrossRef API."""
|
|
|
64 |
except Exception as e:
|
65 |
return f"Error extracting text: {str(e)}"
|
66 |
|
67 |
+
tokenizer = AutoTokenizer.from_pretrained("google/pegasus-x-large")
|
68 |
+
model = PegasusModel.from_pretrained("google/pegasus-x-large")
|
69 |
|
70 |
def summarize_article(article_text):
|
71 |
"""Summarize a given article's text."""
|