Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -122,22 +122,25 @@ def analyze(url, progress=gr.Progress()):
|
|
| 122 |
progress(0, desc="스크립트 추출 중...")
|
| 123 |
title, description, script = get_youtube_script(url)
|
| 124 |
|
| 125 |
-
progress(0.
|
| 126 |
script_sentences = split_sentences(script)
|
| 127 |
script_content = f"# {title}\n\n" + "\n".join(script_sentences)
|
| 128 |
|
| 129 |
-
|
| 130 |
-
|
| 131 |
|
| 132 |
-
progress(0.
|
|
|
|
|
|
|
|
|
|
| 133 |
summary_content = f"# {title}\n\n{summary}"
|
| 134 |
|
| 135 |
progress(1.0, desc="완료")
|
| 136 |
-
|
| 137 |
except Exception as e:
|
| 138 |
error_msg = f"처리 중 오류 발생: {str(e)}"
|
| 139 |
logging.exception(error_msg)
|
| 140 |
-
|
| 141 |
|
| 142 |
# Gradio 인터페이스
|
| 143 |
with gr.Blocks() as demo:
|
|
|
|
| 122 |
progress(0, desc="스크립트 추출 중...")
|
| 123 |
title, description, script = get_youtube_script(url)
|
| 124 |
|
| 125 |
+
progress(0.25, desc="원문 스크립트 처리 중...")
|
| 126 |
script_sentences = split_sentences(script)
|
| 127 |
script_content = f"# {title}\n\n" + "\n".join(script_sentences)
|
| 128 |
|
| 129 |
+
# 원문 스크립트 먼저 출력
|
| 130 |
+
yield script_content, None
|
| 131 |
|
| 132 |
+
progress(0.5, desc="요약 생성 중...")
|
| 133 |
+
summary = summarize_text(title, description, "\n".join(script_sentences))
|
| 134 |
+
|
| 135 |
+
progress(0.75, desc="요약 내용 정리 중...")
|
| 136 |
summary_content = f"# {title}\n\n{summary}"
|
| 137 |
|
| 138 |
progress(1.0, desc="완료")
|
| 139 |
+
yield script_content, summary_content
|
| 140 |
except Exception as e:
|
| 141 |
error_msg = f"처리 중 오류 발생: {str(e)}"
|
| 142 |
logging.exception(error_msg)
|
| 143 |
+
yield error_msg, error_msg
|
| 144 |
|
| 145 |
# Gradio 인터페이스
|
| 146 |
with gr.Blocks() as demo:
|