AIRider commited on
Commit
7b2bf17
ยท
verified ยท
1 Parent(s): 7dc2cb4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +60 -160
app.py CHANGED
@@ -2,12 +2,10 @@ import gradio as gr
2
  from gradio_client import Client
3
  import json
4
  import logging
5
- import ast
6
  import openai
7
  import os
8
- import random
9
- import re
10
 
 
11
  logging.basicConfig(filename='youtube_script_extractor.log', level=logging.DEBUG,
12
  format='%(asctime)s - %(levelname)s - %(message)s')
13
 
@@ -23,59 +21,53 @@ def parse_api_response(response):
23
  raise ValueError(f"์˜ˆ์ƒ์น˜ ๋ชปํ•œ ์‘๋‹ต ํ˜•์‹์ž…๋‹ˆ๋‹ค. ๋ฐ›์€ ๋ฐ์ดํ„ฐ ํƒ€์ž…: {type(response)}")
24
  return response
25
  except Exception as e:
 
26
  raise ValueError(f"API ์‘๋‹ต ํŒŒ์‹ฑ ์‹คํŒจ: {str(e)}")
27
 
28
- def split_sentences(text):
29
- sentences = re.split(r"(๋‹ˆ๋‹ค|์—์š”|๊ตฌ๋‚˜|ํ•ด์š”|๊ตฐ์š”|๊ฒ ์–ด์š”|์‹œ์˜ค|ํ•ด๋ผ|์˜ˆ์š”|์•„์š”|๋ฐ์š”|๋Œ€์š”|์„ธ์š”|์–ด์š”|๊ฒŒ์š”|๊ตฌ์š”|๊ณ ์š”|๋‚˜์š”|ํ•˜์ฃ )(?![\w])", text)
30
- combined_sentences = []
31
- current_sentence = ""
32
- for i in range(0, len(sentences), 2):
33
- if i + 1 < len(sentences):
34
- sentence = sentences[i] + sentences[i + 1]
35
- else:
36
- sentence = sentences[i]
37
- if len(current_sentence) + len(sentence) > 100:
38
- combined_sentences.append(current_sentence.strip())
39
- current_sentence = sentence.strip()
40
- else:
41
- current_sentence += sentence
42
- if sentence.endswith(('.', '?', '!')):
43
- combined_sentences.append(current_sentence.strip())
44
- current_sentence = ""
45
- if current_sentence:
46
- combined_sentences.append(current_sentence.strip())
47
- return combined_sentences
48
-
49
  def get_youtube_script(url):
50
  logging.info(f"์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ์‹œ์ž‘: URL = {url}")
51
-
52
  client = Client("whispersound/YT_Ts_R")
53
-
54
  try:
55
- logging.debug("API ํ˜ธ์ถœ ์‹œ์ž‘")
56
  result = client.predict(youtube_url=url, api_name="/predict")
57
- logging.debug("API ํ˜ธ์ถœ ์™„๋ฃŒ")
58
-
59
  parsed_result = parse_api_response(result)
60
 
61
  if 'data' not in parsed_result or not parsed_result['data']:
62
  raise ValueError("API ์‘๋‹ต์— ์œ ํšจํ•œ ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.")
63
 
64
- title = parsed_result["data"][0].get("title", "์ œ๋ชฉ ์—†์Œ")
65
- transcription_text = parsed_result["data"][0].get("transcriptionAsText", "")
66
- sections = parsed_result["data"][0].get("sections", [])
 
67
 
68
  if not transcription_text:
69
  raise ValueError("์ถ”์ถœ๋œ ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.")
70
 
71
  logging.info("์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ์™„๋ฃŒ")
72
  return title, transcription_text, sections
73
-
74
  except Exception as e:
75
- error_msg = f"์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}"
76
- logging.exception(error_msg)
77
  raise
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  def call_api(prompt, max_tokens, temperature, top_p):
80
  try:
81
  response = openai.ChatCompletion.create(
@@ -90,67 +82,6 @@ def call_api(prompt, max_tokens, temperature, top_p):
90
  logging.exception("LLM API ํ˜ธ์ถœ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ")
91
  raise
92
 
93
- def summarize_section(section_text):
94
- prompt = f"""
95
- ๋‹ค์Œ ์œ ํŠœ๋ธŒ ๋Œ€๋ณธ ์„น์…˜์˜ ํ•ต์‹ฌ ๋‚ด์šฉ์„ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์š”์•ฝํ•˜์„ธ์š”:
96
- 1. ํ•œ๊ธ€๋กœ ์ž‘์„ฑํ•˜์„ธ์š”.
97
- 2. ์ฃผ์š” ๋…ผ์ ๊ณผ ์ค‘์š”ํ•œ ์„ธ๋ถ€์‚ฌํ•ญ์„ ํฌํ•จํ•˜์„ธ์š”.
98
- 3. ์š”์•ฝ์€ 2-3๋ฌธ์žฅ์œผ๋กœ ์ œํ•œํ•˜์„ธ์š”.
99
-
100
- ์„น์…˜ ๋‚ด์šฉ:
101
- {section_text}
102
- """
103
- return call_api(prompt, max_tokens=150, temperature=0.3, top_p=0.9)
104
-
105
- def format_time(seconds):
106
- minutes, seconds = divmod(seconds, 60)
107
- hours, minutes = divmod(minutes, 60)
108
- return f"{int(hours):02d}:{int(minutes):02d}:{int(seconds):02d}"
109
-
110
- def generate_timeline_summary(sections):
111
- combined_sections = "\n\n".join([f"{format_time(section['start_time'])}: {section['text']}" for section in sections])
112
-
113
- prompt = f"""
114
- ๋‹ค์Œ์€ ์œ ํŠœ๋ธŒ ์˜์ƒ์˜ ํƒ€์ž„๋ผ์ธ๊ณผ ๊ฐ ์„น์…˜์˜ ๋‚ด์šฉ์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ํƒ€์ž„๋ผ์ธ ์š”์•ฝ์„ ์ƒ์„ฑํ•ด์ฃผ์„ธ์š”:
115
-
116
- 1. ๊ฐ ์„น์…˜์˜ ์‹œ์ž‘ ์‹œ๊ฐ„์„ ์œ ์ง€ํ•˜๋ฉด์„œ ํ•ต์‹ฌ ๋‚ด์šฉ์„ ๊ฐ„๊ฒฐํ•˜๊ฒŒ ์š”์•ฝํ•˜์„ธ์š”.
117
- 2. ์š”์•ฝ์€ ํ•œ๊ธ€๋กœ ์ž‘์„ฑํ•˜์„ธ์š”.
118
- 3. ๊ฐ ์„น์…˜์˜ ์š”์•ฝ์€ 1-2๋ฌธ์žฅ์œผ๋กœ ์ œํ•œํ•˜์„ธ์š”.
119
- 4. ์ „์ฒด ๋งฅ๋ฝ์„ ๊ณ ๋ คํ•˜์—ฌ ์š”์•ฝํ•˜๋˜, ๊ฐ ์„น์…˜์˜ ๊ณ ์œ ํ•œ ๋‚ด์šฉ์„ ๋†“์น˜์ง€ ๋งˆ์„ธ์š”.
120
- 5. ์ถœ๋ ฅ ํ˜•์‹์€ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ์œ ์ง€ํ•˜์„ธ์š”:
121
- [์‹œ์ž‘ ์‹œ๊ฐ„] ์„น์…˜ ์š”์•ฝ
122
-
123
- ์„น์…˜ ๋‚ด์šฉ:
124
- {combined_sections}
125
- """
126
-
127
- try:
128
- response = call_api(prompt, max_tokens=1000, temperature=0.3, top_p=0.9)
129
-
130
- # ์‘๋‹ต์„ ์ค„ ๋‹จ์œ„๋กœ ๋ถ„๋ฆฌํ•˜๊ณ  ๊ฐ ์ค„์„ HTML ํ˜•์‹์œผ๋กœ ๋ณ€ํ™˜
131
- timeline_items = response.strip().split('\n')
132
- formatted_timeline = []
133
-
134
- for item in timeline_items:
135
- if ':' in item: # ์‹œ๊ฐ„ ์ •๋ณด๊ฐ€ ์žˆ๋Š” ํ•ญ๋ชฉ๋งŒ ์ฒ˜๋ฆฌ
136
- time, summary = item.split(':', 1)
137
- formatted_timeline.append(f"<p><strong>{time.strip()}</strong>:{summary.strip()}</p>")
138
-
139
- timeline_html = "\n".join(formatted_timeline)
140
-
141
- if not timeline_html:
142
- raise ValueError("์œ ํšจํ•œ ํƒ€์ž„๋ผ์ธ ์š”์•ฝ์„ ์ƒ์„ฑํ•˜์ง€ ๋ชปํ–ˆ์Šต๋‹ˆ๋‹ค.")
143
-
144
- return f"""
145
- <h3>ํƒ€์ž„๋ผ์ธ ์š”์•ฝ:</h3>
146
- <div style="white-space: pre-wrap; max-height: 400px; overflow-y: auto; border: 1px solid #ccc; padding: 10px;">
147
- {timeline_html}
148
- </div>
149
- """
150
- except Exception as e:
151
- logging.exception("ํƒ€์ž„๋ผ์ธ ์š”์•ฝ ์ƒ์„ฑ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ")
152
- return "<p>ํƒ€์ž„๋ผ์ธ ์š”์•ฝ์„ ์ƒ์„ฑํ•˜๋Š” ์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์‹œ ์‹œ๋„ํ•ด ์ฃผ์„ธ์š”.</p>"
153
-
154
  def summarize_text(text):
155
  prompt = f"""
156
  1. ๋‹ค์Œ ์ฃผ์–ด์ง€๋Š” ์œ ํŠœ๋ธŒ ๋Œ€๋ณธ์˜ ํ•ต์‹ฌ ์ฃผ์ œ์™€ ๋ชจ๋“  ์ฃผ์š” ๋‚ด์šฉ์„ ์ƒ์„ธํ•˜๊ฒŒ ์š”์•ฝํ•˜๋ผ
@@ -163,86 +94,55 @@ def summarize_text(text):
163
  8. ๋Œ€๋ณธ์—์„œ ์ „๋‹ฌํ•˜๋Š” ๊ฐ์ •์ด๋‚˜ ๋ถ„์œ„๊ธฐ๋„ ํฌํ•จ
164
  9. ๋ฐ˜๋“œ์‹œ ๊ธฐ์ˆ ์  ์šฉ์–ด๋‚˜ ์ „๋ฌธ ์šฉ์–ด๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ์ด๋ฅผ ์ •ํ™•ํ•˜๊ฒŒ ์‚ฌ์šฉ
165
  10. ๋Œ€๋ณธ์˜ ๋ชฉ์ ์ด๋‚˜ ์˜๋„๋ฅผ ํŒŒ์•…ํ•˜๊ณ , ์ด๋ฅผ ์š”์•ฝ์— ๋ฐ˜๋“œ์‹œ ๋ฐ˜์˜
166
- 11. ์ „์ฒด๊ธ€์„ ๋ณด๊ณ 
167
 
168
- ---
 
 
 
169
 
170
- ์ด ํ”„๋กฌํ”„ํŠธ๊ฐ€ ๋„์›€์ด ๋˜์‹œ๊ธธ ๋ฐ”๋ž๋‹ˆ๋‹ค.
171
- \n\n
172
- {text}"""
 
 
 
173
 
174
- return call_api(prompt, max_tokens=10000, temperature=0.3, top_p=0.9)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
 
 
176
  with gr.Blocks() as demo:
177
  gr.Markdown("## YouTube ์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ๋ฐ ์š”์•ฝ ๋„๊ตฌ")
178
-
179
  youtube_url_input = gr.Textbox(label="YouTube URL ์ž…๋ ฅ")
180
  analyze_button = gr.Button("๋ถ„์„ํ•˜๊ธฐ")
181
  script_output = gr.HTML(label="์Šคํฌ๋ฆฝํŠธ")
182
  timeline_output = gr.HTML(label="ํƒ€์ž„๋ผ์ธ ์š”์•ฝ")
183
  summary_output = gr.HTML(label="์ „์ฒด ์š”์•ฝ")
184
-
185
  cached_data = gr.State({"url": "", "title": "", "script": "", "sections": []})
186
 
187
- def extract_and_cache(url, cache):
188
- if url == cache["url"]:
189
- return cache["title"], cache["script"], cache["sections"], cache
190
-
191
- try:
192
- title, script, sections = get_youtube_script(url)
193
- new_cache = {"url": url, "title": title, "script": script, "sections": sections}
194
- return title, script, sections, new_cache
195
- except Exception as e:
196
- logging.exception("๋ฐ์ดํ„ฐ ์ถ”์ถœ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ")
197
- raise gr.Error(f"์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ์‹คํŒจ: {str(e)}")
198
-
199
- def display_script(title, script):
200
- formatted_script = "\n".join(split_sentences(script))
201
- script_html = f"""<h2 style='font-size:24px;'>{title}</h2>
202
- <details>
203
- <summary><h3>์›๋ฌธ ์Šคํฌ๋ฆฝํŠธ (ํด๋ฆญํ•˜์—ฌ ํŽผ์น˜๊ธฐ)</h3></summary>
204
- <div style="white-space: pre-wrap;">{formatted_script}</div>
205
- </details>"""
206
- return script_html
207
-
208
- def display_timeline(sections):
209
- timeline_summary = generate_timeline_summary(sections)
210
- timeline_html = f"""
211
- <h3>ํƒ€์ž„๋ผ์ธ ์š”์•ฝ:</h3>
212
- <div style="white-space: pre-wrap; max-height: 400px; overflow-y: auto; border: 1px solid #ccc; padding: 10px;">
213
- {timeline_summary}
214
- </div>
215
- """
216
- return timeline_html
217
-
218
- def generate_summary(script):
219
- summary = summarize_text(script)
220
- summary_html = f"""
221
- <h3>์ „์ฒด ์š”์•ฝ:</h3>
222
- <div style="white-space: pre-wrap; max-height: 400px; overflow-y: auto; border: 1px solid #ccc; padding: 10px;">
223
- {summary}
224
- </div>
225
- """
226
- return summary_html
227
-
228
- def analyze(url, cache):
229
- try:
230
- title, script, sections, new_cache = extract_and_cache(url, cache)
231
- script_html = display_script(title, script)
232
- timeline_html = generate_timeline_summary(sections)
233
- summary_html = generate_summary(script)
234
- return script_html, timeline_html, summary_html, new_cache
235
- except gr.Error as e:
236
- return str(e), "", "", cache
237
- except Exception as e:
238
- error_msg = f"์ฒ˜๋ฆฌ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}"
239
- logging.exception(error_msg)
240
- return error_msg, "", "", cache
241
-
242
  analyze_button.click(
243
  analyze,
244
  inputs=[youtube_url_input, cached_data],
245
  outputs=[script_output, timeline_output, summary_output, cached_data]
246
  )
247
 
248
- demo.launch(share=True)
 
 
2
  from gradio_client import Client
3
  import json
4
  import logging
 
5
  import openai
6
  import os
 
 
7
 
8
+ # ๋กœ๊น… ์„ค์ •
9
  logging.basicConfig(filename='youtube_script_extractor.log', level=logging.DEBUG,
10
  format='%(asctime)s - %(levelname)s - %(message)s')
11
 
 
21
  raise ValueError(f"์˜ˆ์ƒ์น˜ ๋ชปํ•œ ์‘๋‹ต ํ˜•์‹์ž…๋‹ˆ๋‹ค. ๋ฐ›์€ ๋ฐ์ดํ„ฐ ํƒ€์ž…: {type(response)}")
22
  return response
23
  except Exception as e:
24
+ logging.error(f"API ์‘๋‹ต ํŒŒ์‹ฑ ์‹คํŒจ: {str(e)}")
25
  raise ValueError(f"API ์‘๋‹ต ํŒŒ์‹ฑ ์‹คํŒจ: {str(e)}")
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  def get_youtube_script(url):
28
  logging.info(f"์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ์‹œ์ž‘: URL = {url}")
 
29
  client = Client("whispersound/YT_Ts_R")
 
30
  try:
 
31
  result = client.predict(youtube_url=url, api_name="/predict")
 
 
32
  parsed_result = parse_api_response(result)
33
 
34
  if 'data' not in parsed_result or not parsed_result['data']:
35
  raise ValueError("API ์‘๋‹ต์— ์œ ํšจํ•œ ๋ฐ์ดํ„ฐ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.")
36
 
37
+ data = parsed_result["data"][0]
38
+ title = data.get("title", "์ œ๋ชฉ ์—†์Œ")
39
+ transcription_text = data.get("transcriptionAsText", "")
40
+ sections = data.get("sections", [])
41
 
42
  if not transcription_text:
43
  raise ValueError("์ถ”์ถœ๋œ ์Šคํฌ๋ฆฝํŠธ๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค.")
44
 
45
  logging.info("์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ์™„๋ฃŒ")
46
  return title, transcription_text, sections
 
47
  except Exception as e:
48
+ logging.exception("์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ")
 
49
  raise
50
 
51
+ def format_time(seconds):
52
+ minutes, seconds = divmod(seconds, 60)
53
+ hours, minutes = divmod(minutes, 60)
54
+ return f"{int(hours):02d}:{int(minutes):02d}:{int(seconds):02d}"
55
+
56
+ def generate_timeline_summary(sections):
57
+ timeline_items = []
58
+ for section in sections:
59
+ start_time = format_time(section['start_time'])
60
+ text = section['text']
61
+ timeline_items.append(f"<p><strong>{start_time}</strong>: {text}</p>")
62
+
63
+ timeline_html = "\n".join(timeline_items)
64
+ return f"""
65
+ <h3>ํƒ€์ž„๋ผ์ธ ์š”์•ฝ:</h3>
66
+ <div style="white-space: pre-wrap; max-height: 400px; overflow-y: auto; border: 1px solid #ccc; padding: 10px;">
67
+ {timeline_html}
68
+ </div>
69
+ """
70
+
71
  def call_api(prompt, max_tokens, temperature, top_p):
72
  try:
73
  response = openai.ChatCompletion.create(
 
82
  logging.exception("LLM API ํ˜ธ์ถœ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ")
83
  raise
84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
85
  def summarize_text(text):
86
  prompt = f"""
87
  1. ๋‹ค์Œ ์ฃผ์–ด์ง€๋Š” ์œ ํŠœ๋ธŒ ๋Œ€๋ณธ์˜ ํ•ต์‹ฌ ์ฃผ์ œ์™€ ๋ชจ๋“  ์ฃผ์š” ๋‚ด์šฉ์„ ์ƒ์„ธํ•˜๊ฒŒ ์š”์•ฝํ•˜๋ผ
 
94
  8. ๋Œ€๋ณธ์—์„œ ์ „๋‹ฌํ•˜๋Š” ๊ฐ์ •์ด๋‚˜ ๋ถ„์œ„๊ธฐ๋„ ํฌํ•จ
95
  9. ๋ฐ˜๋“œ์‹œ ๊ธฐ์ˆ ์  ์šฉ์–ด๋‚˜ ์ „๋ฌธ ์šฉ์–ด๊ฐ€ ์žˆ์„ ๊ฒฝ์šฐ, ์ด๋ฅผ ์ •ํ™•ํ•˜๊ฒŒ ์‚ฌ์šฉ
96
  10. ๋Œ€๋ณธ์˜ ๋ชฉ์ ์ด๋‚˜ ์˜๋„๋ฅผ ํŒŒ์•…ํ•˜๊ณ , ์ด๋ฅผ ์š”์•ฝ์— ๋ฐ˜๋“œ์‹œ ๋ฐ˜์˜
 
97
 
98
+ ๋Œ€๋ณธ:
99
+ {text}
100
+ """
101
+ return call_api(prompt, max_tokens=2000, temperature=0.3, top_p=0.9)
102
 
103
+ def display_script(title, script):
104
+ return f"""<h2 style='font-size:24px;'>{title}</h2>
105
+ <details>
106
+ <summary><h3>์›๋ฌธ ์Šคํฌ๋ฆฝํŠธ (ํด๋ฆญํ•˜์—ฌ ํŽผ์น˜๊ธฐ)</h3></summary>
107
+ <div style="white-space: pre-wrap;">{script}</div>
108
+ </details>"""
109
 
110
+ def analyze(url, cache):
111
+ try:
112
+ if url == cache["url"]:
113
+ logging.info(f"์บ์‹œ๋œ ๋ฐ์ดํ„ฐ ์‚ฌ์šฉ: URL = {url}")
114
+ title, script, sections = cache["title"], cache["script"], cache["sections"]
115
+ else:
116
+ logging.info(f"์ƒˆ๋กœ์šด ๋ฐ์ดํ„ฐ ์ถ”์ถœ ์‹œ์ž‘: URL = {url}")
117
+ title, script, sections = get_youtube_script(url)
118
+ cache = {"url": url, "title": title, "script": script, "sections": sections}
119
+
120
+ script_html = display_script(title, script)
121
+ timeline_html = generate_timeline_summary(sections)
122
+ summary_html = summarize_text(script)
123
+
124
+ logging.info("๋ถ„์„ ์™„๋ฃŒ")
125
+ return script_html, timeline_html, summary_html, cache
126
+ except Exception as e:
127
+ error_msg = f"์ฒ˜๋ฆฌ ์ค‘ ์˜ค๋ฅ˜ ๋ฐœ์ƒ: {str(e)}"
128
+ logging.exception(error_msg)
129
+ return error_msg, "", "", cache
130
 
131
+ # Gradio ์ธํ„ฐํŽ˜์ด์Šค
132
  with gr.Blocks() as demo:
133
  gr.Markdown("## YouTube ์Šคํฌ๋ฆฝํŠธ ์ถ”์ถœ ๋ฐ ์š”์•ฝ ๋„๊ตฌ")
 
134
  youtube_url_input = gr.Textbox(label="YouTube URL ์ž…๋ ฅ")
135
  analyze_button = gr.Button("๋ถ„์„ํ•˜๊ธฐ")
136
  script_output = gr.HTML(label="์Šคํฌ๋ฆฝํŠธ")
137
  timeline_output = gr.HTML(label="ํƒ€์ž„๋ผ์ธ ์š”์•ฝ")
138
  summary_output = gr.HTML(label="์ „์ฒด ์š”์•ฝ")
 
139
  cached_data = gr.State({"url": "", "title": "", "script": "", "sections": []})
140
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  analyze_button.click(
142
  analyze,
143
  inputs=[youtube_url_input, cached_data],
144
  outputs=[script_output, timeline_output, summary_output, cached_data]
145
  )
146
 
147
+ if __name__ == "__main__":
148
+ demo.launch(share=True)