Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,17 +1,18 @@
|
|
| 1 |
-
import
|
| 2 |
-
from transformers import pipeline
|
| 3 |
|
| 4 |
-
|
|
|
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
output[prediction['labels'][i]] = prediction['scores'][i]
|
| 12 |
-
return output
|
| 13 |
|
| 14 |
-
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
| 17 |
demo.launch()
|
|
|
|
| 1 |
+
import wikipedia
|
|
|
|
| 2 |
|
| 3 |
+
def wikipediaScrap(article_name, wikipedia_language = "en"):
|
| 4 |
+
if wikipedia_language:
|
| 5 |
+
wikipedia.set_lang(wikipedia_language)
|
| 6 |
|
| 7 |
+
et_page = wikipedia.page(wikipedia_article)
|
| 8 |
+
title = et_page.title
|
| 9 |
+
content = et_page.content
|
| 10 |
+
page_url = et_page.url
|
| 11 |
+
linked_pages = et_page.links
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
return title, page_url, content, "\n". join(linked_pages)
|
| 14 |
|
| 15 |
+
examples = [["Eiffel Tower", "en"], ["Eiffel tower", 'ur']]
|
| 16 |
+
|
| 17 |
+
demo = gr.Interface(fn=wikipediaScrap, inputs=["text", "text"], outputs=["text", "text", "text", "text"], title="Wikipedia Scrap", examples=examples)
|
| 18 |
demo.launch()
|