Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,10 @@ import hashlib
|
|
10 |
import threading
|
11 |
|
12 |
# Global settings
|
13 |
-
|
|
|
|
|
|
|
14 |
CACHE_SIZE = 500 # Cache size for summaries
|
15 |
RSS_FETCH_INTERVAL = timedelta(hours=8)
|
16 |
ARTICLE_LIMIT = 5
|
@@ -30,7 +33,6 @@ NEWS_SOURCES = {
|
|
30 |
}
|
31 |
}
|
32 |
|
33 |
-
# Initialize cache
|
34 |
class NewsCache:
|
35 |
def __init__(self, size):
|
36 |
self.cache = {}
|
@@ -50,7 +52,7 @@ class NewsCache:
|
|
50 |
|
51 |
cache = NewsCache(CACHE_SIZE)
|
52 |
|
53 |
-
summarizer = pipeline("summarization", model=
|
54 |
|
55 |
# Utility functions
|
56 |
def fetch_rss_news(selected_sources):
|
@@ -162,3 +164,4 @@ if __name__ == "__main__":
|
|
162 |
demo.launch()
|
163 |
|
164 |
|
|
|
|
10 |
import threading
|
11 |
|
12 |
# Global settings
|
13 |
+
SUMMARIZER_MODELS = {
|
14 |
+
"Default (facebook/bart-large-cnn)": "facebook/bart-large-cnn",
|
15 |
+
"Free Model (distilbart-cnn-6-6)": "sshleifer/distilbart-cnn-6-6"
|
16 |
+
}
|
17 |
CACHE_SIZE = 500 # Cache size for summaries
|
18 |
RSS_FETCH_INTERVAL = timedelta(hours=8)
|
19 |
ARTICLE_LIMIT = 5
|
|
|
33 |
}
|
34 |
}
|
35 |
|
|
|
36 |
class NewsCache:
|
37 |
def __init__(self, size):
|
38 |
self.cache = {}
|
|
|
52 |
|
53 |
cache = NewsCache(CACHE_SIZE)
|
54 |
|
55 |
+
summarizer = pipeline("summarization", model=SUMMARIZER_MODELS["Default (facebook/bart-large-cnn)"], device=-1)
|
56 |
|
57 |
# Utility functions
|
58 |
def fetch_rss_news(selected_sources):
|
|
|
164 |
demo.launch()
|
165 |
|
166 |
|
167 |
+
|