burtenshaw commited on
Commit
903f1b2
·
1 Parent(s): adb259d

add progress bar and fix template

Browse files
Files changed (1) hide show
  1. app/app.py +7 -3
app/app.py CHANGED
@@ -251,7 +251,7 @@ def generate_pdf_from_markdown(markdown_file_path, output_pdf_path):
251
 
252
 
253
  # --- Helper Function to Read CSS ---
254
- def load_css(css_path="template/style.css"):
255
  """Loads CSS content from a file."""
256
  try:
257
  with open(css_path, "r", encoding="utf-8") as f:
@@ -296,8 +296,8 @@ def step1_fetch_and_generate_presentation(url, progress=gr.Progress(track_tqdm=T
296
  )
297
 
298
  # --- Copy Template Directory for Cached Item ---
299
- template_src_dir = "template"
300
- template_dest_dir = os.path.join(temp_dir, "template")
301
  if os.path.isdir(template_src_dir):
302
  try:
303
  shutil.copytree(template_src_dir, template_dest_dir)
@@ -999,6 +999,7 @@ with gr.Blocks(
999
  fn=step1_fetch_and_generate_presentation,
1000
  inputs=[input_url],
1001
  outputs=step1_outputs,
 
1002
  ).then(
1003
  fn=lambda s_data: [
1004
  upd
@@ -1045,6 +1046,7 @@ with gr.Blocks(
1045
  fn=step2_build_slides,
1046
  inputs=step2_inputs,
1047
  outputs=step2_outputs,
 
1048
  ).then(
1049
  fn=lambda image_paths: [
1050
  gr.update(
@@ -1077,6 +1079,7 @@ with gr.Blocks(
1077
  fn=step3_generate_audio,
1078
  inputs=step3_inputs,
1079
  outputs=step3_outputs,
 
1080
  ).then(lambda: gr.update(selected=3), outputs=tabs_widget) # Switch to Tab 4
1081
 
1082
  # Step 4 Click Handler
@@ -1089,6 +1092,7 @@ with gr.Blocks(
1089
  fn=step4_generate_video,
1090
  inputs=step4_inputs,
1091
  outputs=step4_outputs,
 
1092
  )
1093
 
1094
  if __name__ == "__main__":
 
251
 
252
 
253
  # --- Helper Function to Read CSS ---
254
+ def load_css(css_path="app/template/style.css"):
255
  """Loads CSS content from a file."""
256
  try:
257
  with open(css_path, "r", encoding="utf-8") as f:
 
296
  )
297
 
298
  # --- Copy Template Directory for Cached Item ---
299
+ template_src_dir = "app/template"
300
+ template_dest_dir = os.path.join(temp_dir, "app/template")
301
  if os.path.isdir(template_src_dir):
302
  try:
303
  shutil.copytree(template_src_dir, template_dest_dir)
 
999
  fn=step1_fetch_and_generate_presentation,
1000
  inputs=[input_url],
1001
  outputs=step1_outputs,
1002
+ show_progress="full",
1003
  ).then(
1004
  fn=lambda s_data: [
1005
  upd
 
1046
  fn=step2_build_slides,
1047
  inputs=step2_inputs,
1048
  outputs=step2_outputs,
1049
+ show_progress="full",
1050
  ).then(
1051
  fn=lambda image_paths: [
1052
  gr.update(
 
1079
  fn=step3_generate_audio,
1080
  inputs=step3_inputs,
1081
  outputs=step3_outputs,
1082
+ show_progress="full",
1083
  ).then(lambda: gr.update(selected=3), outputs=tabs_widget) # Switch to Tab 4
1084
 
1085
  # Step 4 Click Handler
 
1092
  fn=step4_generate_video,
1093
  inputs=step4_inputs,
1094
  outputs=step4_outputs,
1095
+ show_progress="full",
1096
  )
1097
 
1098
  if __name__ == "__main__":