Spaces:
Runtime error
Runtime error
feat: add update news data (button)
#5
by
Hyeonseo
- opened
app.py
CHANGED
@@ -66,13 +66,14 @@ class news_collector:
|
|
66 |
|
67 |
|
68 |
|
69 |
-
|
70 |
-
news = news_collector()
|
71 |
-
news.update_news_examples()
|
72 |
-
return news.examples_text
|
73 |
-
|
74 |
-
|
75 |
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
title = "κ· νμ‘ν λ΄μ€ μ½κΈ° (Balanced News Reading)"
|
78 |
|
@@ -102,9 +103,12 @@ with gr.Blocks(theme='pseudolab/huggingface-korea-theme') as demo:
|
|
102 |
gr.load("models/gabrielyang/finance_news_classifier-KR_v7",
|
103 |
inputs = Link_TXT)
|
104 |
Link_URL = gr.Textbox(label="λ΄μ€ URL")
|
105 |
-
|
|
|
|
|
|
|
106 |
gr.Examples(
|
107 |
-
|
108 |
[Link_TXT, Link_URL],
|
109 |
)
|
110 |
|
|
|
66 |
|
67 |
|
68 |
|
69 |
+
news_data = []
|
|
|
|
|
|
|
|
|
|
|
70 |
|
71 |
+
def update_news_data():
|
72 |
+
global news_data
|
73 |
+
news_data = news_collector().update_news_examples()
|
74 |
+
print("λ΄μ€ λ°μ΄ν° μ
λ°μ΄νΈ μλ£")
|
75 |
+
|
76 |
+
update_news_data()
|
77 |
|
78 |
title = "κ· νμ‘ν λ΄μ€ μ½κΈ° (Balanced News Reading)"
|
79 |
|
|
|
103 |
gr.load("models/gabrielyang/finance_news_classifier-KR_v7",
|
104 |
inputs = Link_TXT)
|
105 |
Link_URL = gr.Textbox(label="λ΄μ€ URL")
|
106 |
+
|
107 |
+
update_button = gr.Button(value="λ΄μ€ λ°μ΄ν° μ
λ°μ΄νΈ")
|
108 |
+
update_button.click(fn=update_news_data, inputs=None, outputs=None)
|
109 |
+
|
110 |
gr.Examples(
|
111 |
+
news_data,
|
112 |
[Link_TXT, Link_URL],
|
113 |
)
|
114 |
|