Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import newspaper
|
| 3 |
from newspaper import Article
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
import nltk
|
| 5 |
nltk.download('punkt')
|
| 6 |
def art(url):
|
| 7 |
-
art=Article(url)
|
| 8 |
art.download()
|
| 9 |
art.parse()
|
| 10 |
art.nlp()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import newspaper
|
| 3 |
from newspaper import Article
|
| 4 |
+
from newspaper import Config
|
| 5 |
+
user_agent = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36'
|
| 6 |
+
config = Config()
|
| 7 |
+
config.browser_user_agent = user_agent
|
| 8 |
import nltk
|
| 9 |
nltk.download('punkt')
|
| 10 |
def art(url):
|
| 11 |
+
art=Article(url,config=config)
|
| 12 |
art.download()
|
| 13 |
art.parse()
|
| 14 |
art.nlp()
|