Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -78,24 +78,17 @@ def summarize_text(text):
|
|
| 78 |
๋๋ณธ:
|
| 79 |
{text}
|
| 80 |
"""
|
| 81 |
-
return call_api(prompt, max_tokens=
|
| 82 |
|
| 83 |
-
def
|
| 84 |
return f"""
|
| 85 |
-
<
|
| 86 |
-
<
|
| 87 |
-
|
| 88 |
-
<h3
|
| 89 |
-
<div style="white-space: pre-wrap; background-color: #f0f0f0; padding: 15px; border-radius: 5px;">{
|
| 90 |
</div>
|
| 91 |
-
|
| 92 |
-
<h2 style='font-size:24px;'>{title}</h2>
|
| 93 |
-
<details>
|
| 94 |
-
<summary><h3>์๋ฌธ ์คํฌ๋ฆฝํธ (ํด๋ฆญํ์ฌ ํผ์น๊ธฐ)</h3></summary>
|
| 95 |
-
<div style="white-space: pre-wrap; background-color: #e0e0e0; padding: 15px; border-radius: 5px;">{script}</div>
|
| 96 |
-
</details>
|
| 97 |
-
</div>
|
| 98 |
-
</div>
|
| 99 |
"""
|
| 100 |
|
| 101 |
def analyze(url, cache):
|
|
@@ -108,15 +101,19 @@ def analyze(url, cache):
|
|
| 108 |
title, script = get_youtube_script(url)
|
| 109 |
cache = {"url": url, "title": title, "script": script}
|
| 110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 111 |
summary = summarize_text(script)
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
return content_html, cache
|
| 116 |
except Exception as e:
|
| 117 |
error_msg = f"์ฒ๋ฆฌ ์ค ์ค๋ฅ ๋ฐ์: {str(e)}"
|
| 118 |
logging.exception(error_msg)
|
| 119 |
-
|
| 120 |
|
| 121 |
# Gradio ์ธํฐํ์ด์ค
|
| 122 |
with gr.Blocks() as demo:
|
|
|
|
| 78 |
๋๋ณธ:
|
| 79 |
{text}
|
| 80 |
"""
|
| 81 |
+
return call_api(prompt, max_tokens=2000, temperature=0.3, top_p=0.9)
|
| 82 |
|
| 83 |
+
def create_collapsible_section(section_title, video_title, content):
|
| 84 |
return f"""
|
| 85 |
+
<details>
|
| 86 |
+
<summary style="cursor: pointer; font-weight: bold;">{section_title}</summary>
|
| 87 |
+
<div style="margin-top: 10px;">
|
| 88 |
+
<h3 style="font-size: 18px; margin-bottom: 10px;">{video_title}</h3>
|
| 89 |
+
<div style="white-space: pre-wrap; background-color: #f0f0f0; padding: 15px; border-radius: 5px;">{content}</div>
|
| 90 |
</div>
|
| 91 |
+
</details>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
"""
|
| 93 |
|
| 94 |
def analyze(url, cache):
|
|
|
|
| 101 |
title, script = get_youtube_script(url)
|
| 102 |
cache = {"url": url, "title": title, "script": script}
|
| 103 |
|
| 104 |
+
# ์๋ฌธ ์คํฌ๋ฆฝํธ ์น์
์์ฑ
|
| 105 |
+
script_section = create_collapsible_section("์๋ฌธ ์คํฌ๋ฆฝํธ", title, script)
|
| 106 |
+
yield script_section, cache
|
| 107 |
+
|
| 108 |
+
# ์์ฝ ์์ฑ ๋ฐ ์น์
์์ฑ
|
| 109 |
summary = summarize_text(script)
|
| 110 |
+
summary_section = create_collapsible_section("์์ฝ", title, summary)
|
| 111 |
+
yield script_section + summary_section, cache
|
| 112 |
+
|
|
|
|
| 113 |
except Exception as e:
|
| 114 |
error_msg = f"์ฒ๋ฆฌ ์ค ์ค๋ฅ ๋ฐ์: {str(e)}"
|
| 115 |
logging.exception(error_msg)
|
| 116 |
+
yield error_msg, cache
|
| 117 |
|
| 118 |
# Gradio ์ธํฐํ์ด์ค
|
| 119 |
with gr.Blocks() as demo:
|