youngtsai commited on
Commit
a9eaf66
1 Parent(s): ae88c8d

df_string_output = json.dumps(transcript, ensure_ascii=False, indent=2)

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -287,15 +287,17 @@ def process_youtube_link(link):
287
 
288
  # 基于逐字稿生成其他所需的输出
289
  questions = generate_questions(transcript)
 
 
290
  df_summarise = generate_df_summarise(transcript)
291
 
292
  # 确保返回与 UI 组件预期匹配的输出
293
  return questions[0] if len(questions) > 0 else "", \
294
  questions[1] if len(questions) > 1 else "", \
295
  questions[2] if len(questions) > 2 else "", \
 
296
  df_summarise, \
297
- html_content, \
298
- screenshot_paths,
299
 
300
  def format_transcript_to_html(formatted_transcript):
301
  html_content = ""
@@ -460,10 +462,7 @@ with gr.Blocks() as demo:
460
 
461
  with gr.Column():
462
  with gr.Tab("YouTube Transcript and Video"):
463
- transcript_html = gr.HTML(label="YouTube Transcript and Video")
464
- with gr.Tab("images"):
465
- gallery = gr.Gallery(label="截图")
466
-
467
  with gr.Tab("資料本文"):
468
  df_string_output = gr.Textbox()
469
  with gr.Tab("資料摘要"):
@@ -490,7 +489,7 @@ with gr.Blocks() as demo:
490
  file_upload.change(process_file, inputs=file_upload, outputs=[btn_1, btn_2, btn_3, df_summarise, df_string_output])
491
 
492
  # 当输入 YouTube 链接时触发
493
- youtube_link.change(process_youtube_link, inputs=youtube_link, outputs=[btn_1, btn_2, btn_3, df_summarise, transcript_html, gallery])
494
 
495
  # 当输入网页链接时触发
496
  web_link.change(process_web_link, inputs=web_link, outputs=[btn_1, btn_2, btn_3, df_summarise, df_string_output])
 
287
 
288
  # 基于逐字稿生成其他所需的输出
289
  questions = generate_questions(transcript)
290
+ # 将 DataFrame 转换为纯文本,並分行
291
+ df_string_output = json.dumps(transcript, ensure_ascii=False, indent=2)
292
  df_summarise = generate_df_summarise(transcript)
293
 
294
  # 确保返回与 UI 组件预期匹配的输出
295
  return questions[0] if len(questions) > 0 else "", \
296
  questions[1] if len(questions) > 1 else "", \
297
  questions[2] if len(questions) > 2 else "", \
298
+ df_string_output, \
299
  df_summarise, \
300
+ html_content,
 
301
 
302
  def format_transcript_to_html(formatted_transcript):
303
  html_content = ""
 
462
 
463
  with gr.Column():
464
  with gr.Tab("YouTube Transcript and Video"):
465
+ transcript_html = gr.HTML(label="YouTube Transcript and Video")
 
 
 
466
  with gr.Tab("資料本文"):
467
  df_string_output = gr.Textbox()
468
  with gr.Tab("資料摘要"):
 
489
  file_upload.change(process_file, inputs=file_upload, outputs=[btn_1, btn_2, btn_3, df_summarise, df_string_output])
490
 
491
  # 当输入 YouTube 链接时触发
492
+ youtube_link.change(process_youtube_link, inputs=youtube_link, outputs=[btn_1, btn_2, btn_3, df_string_output, df_summarise, transcript_html])
493
 
494
  # 当输入网页链接时触发
495
  web_link.change(process_web_link, inputs=web_link, outputs=[btn_1, btn_2, btn_3, df_summarise, df_string_output])