Update app.py
Browse files
app.py
CHANGED
|
@@ -142,11 +142,20 @@ def process_multiple_urls(urls_text, output_dir):
|
|
| 142 |
for url in urls:
|
| 143 |
all_results.extend(process_url(url, output_dir))
|
| 144 |
all_results.append("-" * 50)
|
| 145 |
-
|
| 146 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
# Gradio UI
|
|
|
|
| 148 |
with gr.Blocks() as app:
|
| 149 |
-
gr.Markdown("# โจ ํฐ์คํ ๋ฆฌ ์๋ ์ฒ๋ฆฌ๊ธฐ โจ\n- ์ด๋ฏธ์ง ๋ฐฐ๊ฒฝ ์ ๊ฑฐ + ์ํฐ๋งํฌ ์ฝ์
\n- ์ ํ๋ช
์ถ์ถ ํ ์ฟ ํก ๊ฒ์ ๋งํฌ ์์ฑ\n-
|
| 150 |
|
| 151 |
with gr.Row():
|
| 152 |
urls_input = gr.Textbox(label="ํฐ์คํ ๋ฆฌ ๊ฒ์๊ธ URL ์ฌ๋ฌ ๊ฐ (์ค๋ฐ๊ฟํด์ ์
๋ ฅ)", lines=5, placeholder="https://example1.com\nhttps://example2.com")
|
|
@@ -155,7 +164,12 @@ with gr.Blocks() as app:
|
|
| 155 |
|
| 156 |
process_button = gr.Button("์ฒ๋ฆฌ ์์ ๐")
|
| 157 |
output_text = gr.Textbox(label="๊ฒฐ๊ณผ", lines=20)
|
|
|
|
| 158 |
|
| 159 |
-
process_button.click(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 160 |
|
| 161 |
app.launch()
|
|
|
|
| 142 |
for url in urls:
|
| 143 |
all_results.extend(process_url(url, output_dir))
|
| 144 |
all_results.append("-" * 50)
|
| 145 |
+
|
| 146 |
+
final_text = "\n".join(all_results)
|
| 147 |
+
|
| 148 |
+
# ๊ฒฐ๊ณผ๋ฅผ ํ์ผ๋ก ์ ์ฅ
|
| 149 |
+
os.makedirs(output_dir, exist_ok=True)
|
| 150 |
+
result_file_path = os.path.join(output_dir, "result_log.txt")
|
| 151 |
+
with open(result_file_path, 'w', encoding='utf-8') as f:
|
| 152 |
+
f.write(final_text)
|
| 153 |
+
|
| 154 |
+
return final_text, result_file_path
|
| 155 |
# Gradio UI
|
| 156 |
+
# Gradio ์ฑ
|
| 157 |
with gr.Blocks() as app:
|
| 158 |
+
gr.Markdown("# โจ ํฐ์คํ ๋ฆฌ ์๋ ์ฒ๋ฆฌ๊ธฐ โจ\n- ์ด๋ฏธ์ง ๋ฐฐ๊ฒฝ ์ ๊ฑฐ + ์ํฐ๋งํฌ ์ฝ์
\n- ์ ํ๋ช
์ถ์ถ ํ ์ฟ ํก ๊ฒ์ ๋งํฌ ์์ฑ\n- ๋ค์ด๋ก๋ ๊ธฐ๋ฅ ์ถ๊ฐ!")
|
| 159 |
|
| 160 |
with gr.Row():
|
| 161 |
urls_input = gr.Textbox(label="ํฐ์คํ ๋ฆฌ ๊ฒ์๊ธ URL ์ฌ๋ฌ ๊ฐ (์ค๋ฐ๊ฟํด์ ์
๋ ฅ)", lines=5, placeholder="https://example1.com\nhttps://example2.com")
|
|
|
|
| 164 |
|
| 165 |
process_button = gr.Button("์ฒ๋ฆฌ ์์ ๐")
|
| 166 |
output_text = gr.Textbox(label="๊ฒฐ๊ณผ", lines=20)
|
| 167 |
+
download_file = gr.File(label="๊ฒฐ๊ณผ ๋ค์ด๋ก๋") # ๋ค์ด๋ก๋ ๋ฒํผ ์ถ๊ฐ
|
| 168 |
|
| 169 |
+
process_button.click(
|
| 170 |
+
fn=process_multiple_urls,
|
| 171 |
+
inputs=[urls_input, output_folder],
|
| 172 |
+
outputs=[output_text, download_file] # ์ถ๋ ฅ ๋ ๊ฐ ์ฐ๊ฒฐ
|
| 173 |
+
)
|
| 174 |
|
| 175 |
app.launch()
|