Update app.py
Browse files
app.py
CHANGED
@@ -116,14 +116,14 @@ def format_results_from_raw(results):
|
|
116 |
|
117 |
# ๋ฆฌ์คํธ ํ์์ ๊ธฐ์ฌ
|
118 |
list_item = f"""
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
list_output += list_item
|
128 |
|
129 |
# ๋ด์ค ๊ฒฐ๊ณผ์ ๋๋ฒ๊ทธ ์ ๋ณด๋ฅผ ๋ฐํ
|
@@ -148,7 +148,7 @@ footer {
|
|
148 |
"""
|
149 |
|
150 |
# Gradio ์ธํฐํ์ด์ค ๊ตฌ์ฑ
|
151 |
-
with gr.Blocks(
|
152 |
gr.Markdown("## 24์๊ฐ ์ด๋ด ๋ด์ค ๊ฒ์ ์ธํฐํ์ด์ค")
|
153 |
gr.Markdown("๊ฒ์์ด๋ฅผ ์
๋ ฅํ๊ณ ๊ตญ๊ฐ๋ฅผ ์ ํํ์ฌ 24์๊ฐ ์ด๋ด์ ๋ด์ค ๊ฒฐ๊ณผ๋ฅผ ๊ฐ์ ธ์ต๋๋ค.")
|
154 |
|
@@ -160,4 +160,25 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme",css=css, title="24์๊ฐ ์ด๋ด ๋ด์ค
|
|
160 |
page = gr.Slider(1, 10, 1, label="ํ์ด์ง")
|
161 |
num_result = gr.Slider(1, 100, 10, label="๊ฒฐ๊ณผ ์")
|
162 |
|
163 |
-
search_button =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
|
117 |
# ๋ฆฌ์คํธ ํ์์ ๊ธฐ์ฌ
|
118 |
list_item = f"""
|
119 |
+
{idx}. ์ ๋ชฉ: {title}
|
120 |
+
๋งํฌ: {link}
|
121 |
+
์์ฝ: {snippet}
|
122 |
+
์ถ์ฒ: {channel}
|
123 |
+
์๊ฐ: {time}
|
124 |
+
์ด๋ฏธ์ง URL: {image_url}
|
125 |
+
------------------------------
|
126 |
+
"""
|
127 |
list_output += list_item
|
128 |
|
129 |
# ๋ด์ค ๊ฒฐ๊ณผ์ ๋๋ฒ๊ทธ ์ ๋ณด๋ฅผ ๋ฐํ
|
|
|
148 |
"""
|
149 |
|
150 |
# Gradio ์ธํฐํ์ด์ค ๊ตฌ์ฑ
|
151 |
+
with gr.Blocks(css=css, title="24์๊ฐ ์ด๋ด ๋ด์ค ๊ฒ์ ์ธํฐํ์ด์ค") as iface:
|
152 |
gr.Markdown("## 24์๊ฐ ์ด๋ด ๋ด์ค ๊ฒ์ ์ธํฐํ์ด์ค")
|
153 |
gr.Markdown("๊ฒ์์ด๋ฅผ ์
๋ ฅํ๊ณ ๊ตญ๊ฐ๋ฅผ ์ ํํ์ฌ 24์๊ฐ ์ด๋ด์ ๋ด์ค ๊ฒฐ๊ณผ๋ฅผ ๊ฐ์ ธ์ต๋๋ค.")
|
154 |
|
|
|
160 |
page = gr.Slider(1, 10, 1, label="ํ์ด์ง")
|
161 |
num_result = gr.Slider(1, 100, 10, label="๊ฒฐ๊ณผ ์")
|
162 |
|
163 |
+
search_button = gr.Button("๊ฒ์") # ๋๋ฝ๋ ๋ถ๋ถ ์ถ๊ฐ
|
164 |
+
|
165 |
+
with gr.Tab("๋ด์ค ๊ฒฐ๊ณผ"):
|
166 |
+
news_output = gr.HTML(label="๋ด์ค ๊ฒฐ๊ณผ")
|
167 |
+
|
168 |
+
with gr.Tab("๋ฆฌ์คํธ"):
|
169 |
+
list_output = gr.Textbox(label="๋ฆฌ์คํธ ๊ฒฐ๊ณผ", lines=20)
|
170 |
+
|
171 |
+
with gr.Tab("๋๋ฒ๊ทธ ์ ๋ณด"):
|
172 |
+
debug_output = gr.Textbox(label="๋๋ฒ๊ทธ ์ ๋ณด", lines=10)
|
173 |
+
|
174 |
+
def search_and_display(query, country, page, num_result):
|
175 |
+
combined_output, list_output_text, debug_info = serphouse_search(query, country, page, num_result)
|
176 |
+
return {news_output: combined_output, list_output: list_output_text, debug_output: debug_info}
|
177 |
+
|
178 |
+
search_button.click(
|
179 |
+
search_and_display,
|
180 |
+
inputs=[query, country, page, num_result],
|
181 |
+
outputs=[news_output, list_output, debug_output]
|
182 |
+
)
|
183 |
+
|
184 |
+
iface.launch(auth=("gini", "pick"))
|