AIRider commited on
Commit
9448ef3
ยท
verified ยท
1 Parent(s): f3279ca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -146,20 +146,26 @@ def analyze(url):
146
  summary = summarize_text(title, description, script)
147
 
148
  # ๋งˆํฌ๋‹ค์šด ๊ธฐํ˜ธ ์ œ๊ฑฐ ๋ฐ HTML ํƒœ๊ทธ๋กœ ์ง์ ‘ ๋ณ€ํ™˜
149
- summary = summary.replace("### ๐Ÿ“„", "<h3>๐Ÿ“„")
150
- summary = summary.replace("### ๐Ÿ’ป", "<h3>๐Ÿ’ป")
 
 
 
 
 
 
 
 
151
 
152
  summary_content = f"""<div style="background-color: #e6f3ff; padding: 20px; border-radius: 10px; margin-top: 20px;">
153
  <h3>์š”์•ฝ</h3>
154
  <h2>{title}</h2>
155
- {summary}
156
  </div>"""
157
 
158
  # ์ตœ์ข… ๊ฒฐ๊ณผ ํ‘œ์‹œ
159
  yield script_content, summary_content
160
 
161
- # Gradio ์ธํ„ฐํŽ˜์ด์Šค๋Š” ์ด์ „๊ณผ ๋™์ผ
162
-
163
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค
164
  with gr.Blocks() as demo:
165
  gr.Markdown("## YouTube ์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ๋ฐ ์š”์•ฝ ๋„๊ตฌ")
 
146
  summary = summarize_text(title, description, script)
147
 
148
  # ๋งˆํฌ๋‹ค์šด ๊ธฐํ˜ธ ์ œ๊ฑฐ ๋ฐ HTML ํƒœ๊ทธ๋กœ ์ง์ ‘ ๋ณ€ํ™˜
149
+ lines = summary.split('\n')
150
+ formatted_lines = []
151
+ for line in lines:
152
+ if line.startswith('###'):
153
+ line = f"<h3>{line[4:]}</h3>"
154
+ else:
155
+ line = f"<p>{line}</p>"
156
+ formatted_lines.append(line)
157
+
158
+ formatted_summary = '\n'.join(formatted_lines)
159
 
160
  summary_content = f"""<div style="background-color: #e6f3ff; padding: 20px; border-radius: 10px; margin-top: 20px;">
161
  <h3>์š”์•ฝ</h3>
162
  <h2>{title}</h2>
163
+ {formatted_summary}
164
  </div>"""
165
 
166
  # ์ตœ์ข… ๊ฒฐ๊ณผ ํ‘œ์‹œ
167
  yield script_content, summary_content
168
 
 
 
169
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค
170
  with gr.Blocks() as demo:
171
  gr.Markdown("## YouTube ์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ๋ฐ ์š”์•ฝ ๋„๊ตฌ")