Spaces:
Runtime error
Runtime error
Commit
ยท
d47bebc
1
Parent(s):
bca29d2
fix null example issue
Browse files
app.py
CHANGED
|
@@ -44,6 +44,7 @@ class news_collector:
|
|
| 44 |
def __init__(self):
|
| 45 |
self.examples_text = []
|
| 46 |
|
|
|
|
| 47 |
def get_new_parser(self, url):
|
| 48 |
article = Article(url, language='ko')
|
| 49 |
article.download()
|
|
@@ -72,23 +73,14 @@ class news_collector:
|
|
| 72 |
self.examples_text.append([get_summary(article.text[:1500]), news_url])
|
| 73 |
|
| 74 |
|
| 75 |
-
|
| 76 |
-
news_data = []
|
| 77 |
-
|
| 78 |
-
def update_news_data():
|
| 79 |
-
global news_data
|
| 80 |
-
news_data = news_collector().update_news_examples()
|
| 81 |
-
print("๋ด์ค ๋ฐ์ดํฐ ์
๋ฐ์ดํธ ์๋ฃ")
|
| 82 |
-
|
| 83 |
-
update_news_data()
|
| 84 |
-
|
| 85 |
title = "๊ท ํ์กํ ๋ด์ค ์ฝ๊ธฐ (Balanced News Reading)"
|
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
with gr.Blocks(theme='pseudolab/huggingface-korea-theme') as demo:
|
| 90 |
-
|
| 91 |
-
|
|
|
|
| 92 |
|
| 93 |
with gr.Tab("์๊ฐ"):
|
| 94 |
gr.Markdown(
|
|
@@ -112,11 +104,12 @@ with gr.Blocks(theme='pseudolab/huggingface-korea-theme') as demo:
|
|
| 112 |
inputs = Link_TXT)
|
| 113 |
Link_URL = gr.Textbox(label="๋ด์ค URL")
|
| 114 |
|
| 115 |
-
|
| 116 |
-
update_button.
|
|
|
|
| 117 |
|
| 118 |
gr.Examples(
|
| 119 |
-
|
| 120 |
[Link_TXT, Link_URL],
|
| 121 |
)
|
| 122 |
|
|
|
|
| 44 |
def __init__(self):
|
| 45 |
self.examples_text = []
|
| 46 |
|
| 47 |
+
|
| 48 |
def get_new_parser(self, url):
|
| 49 |
article = Article(url, language='ko')
|
| 50 |
article.download()
|
|
|
|
| 73 |
self.examples_text.append([get_summary(article.text[:1500]), news_url])
|
| 74 |
|
| 75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 76 |
title = "๊ท ํ์กํ ๋ด์ค ์ฝ๊ธฐ (Balanced News Reading)"
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
with gr.Blocks(theme='pseudolab/huggingface-korea-theme') as demo:
|
| 81 |
+
|
| 82 |
+
collector = news_collector()
|
| 83 |
+
collector.update_news_examples()
|
| 84 |
|
| 85 |
with gr.Tab("์๊ฐ"):
|
| 86 |
gr.Markdown(
|
|
|
|
| 104 |
inputs = Link_TXT)
|
| 105 |
Link_URL = gr.Textbox(label="๋ด์ค URL")
|
| 106 |
|
| 107 |
+
# diable due to dynamic loading
|
| 108 |
+
# update_button = gr.Button(value="๋ด์ค ๋ฐ์ดํฐ ์
๋ฐ์ดํธ")
|
| 109 |
+
# update_button.click(fn=collector.update_news_examples_and_update, inputs=None, outputs=None)
|
| 110 |
|
| 111 |
gr.Examples(
|
| 112 |
+
collector.examples_text,
|
| 113 |
[Link_TXT, Link_URL],
|
| 114 |
)
|
| 115 |
|