Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ import requests
|
|
| 4 |
import nltk
|
| 5 |
from transformers import pipeline
|
| 6 |
import gradio as gr
|
|
|
|
| 7 |
|
| 8 |
# Configure logging
|
| 9 |
logging.basicConfig(level=logging.DEBUG)
|
|
@@ -14,6 +15,9 @@ summarizer = pipeline("summarization")
|
|
| 14 |
# Initialize the NLTK sentence tokenizer
|
| 15 |
nltk.download('punkt')
|
| 16 |
|
|
|
|
|
|
|
|
|
|
| 17 |
# Function to fetch content from a given URL
|
| 18 |
def fetch_article_content(url):
|
| 19 |
try:
|
|
@@ -83,4 +87,4 @@ iface = gr.Interface(
|
|
| 83 |
)
|
| 84 |
|
| 85 |
if __name__ == "__main__":
|
| 86 |
-
iface.launch()
|
|
|
|
| 4 |
import nltk
|
| 5 |
from transformers import pipeline
|
| 6 |
import gradio as gr
|
| 7 |
+
from newsapi import NewsApiClient # Import NewsApiClient from newsapi library
|
| 8 |
|
| 9 |
# Configure logging
|
| 10 |
logging.basicConfig(level=logging.DEBUG)
|
|
|
|
| 15 |
# Initialize the NLTK sentence tokenizer
|
| 16 |
nltk.download('punkt')
|
| 17 |
|
| 18 |
+
# Initialize the News API client with your API key
|
| 19 |
+
newsapi = NewsApiClient(api_key='your_newsapi_key_here')
|
| 20 |
+
|
| 21 |
# Function to fetch content from a given URL
|
| 22 |
def fetch_article_content(url):
|
| 23 |
try:
|
|
|
|
| 87 |
)
|
| 88 |
|
| 89 |
if __name__ == "__main__":
|
| 90 |
+
iface.launch()
|