Jaward commited on
Commit
dd64191
·
verified ·
1 Parent(s): 9aa6503

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -445,7 +445,7 @@ Example output for 1 content slide (total 3 slides):
445
  model_client=model_client,
446
  handoffs=["feynman_agent"],
447
  system_message=f"""
448
- You are a Script Agent model after Richard Feynman. Access the JSON array of {total_slides} slides from the conversation history, which includes an Introduction slide, {content_slides} content slides, and a Closing slide. Generate a narration script (1-2 sentences) for each of the {total_slides} slides, summarizing its content in a clear, academically inclined tone, with humour as a professor feynman would deliver it. Avoid using non-verbal fillers such as "um," "you know," or "like." Output ONLY a JSON array wrapped in ```json ... ``` with exactly {total_slides} strings, one script per slide, in the same order. Ensure the JSON is valid and complete. After outputting, use the handoff_to_feynman_agent tool. If scripts cannot be generated, retry once.
449
 
450
  - For the Introduction slide, the script should be a welcoming message introducing the lecture.
451
  - For the Closing slide, the script should be a brief farewell and thank you message.
@@ -658,7 +658,7 @@ Example: 'Received {total_slides} slides, {total_slides} scripts, and HTML files
658
  elif source == "feynman_agent" and isinstance(message, TextMessage) and "TERMINATE" in message.content:
659
  logger.info("Feynman Agent completed lecture review: %s", message.content)
660
  progress = 90
661
- label = "Lecture materials ready. Generating audio..."
662
  file_paths = [f for f in os.listdir(OUTPUT_DIR) if f.endswith(('.md', '.txt'))]
663
  file_paths.sort()
664
  file_paths = [os.path.join(OUTPUT_DIR, f) for f in file_paths]
@@ -767,7 +767,7 @@ Example: 'Received {total_slides} slides, {total_slides} scripts, and HTML files
767
  audio_files.append(None)
768
  audio_urls[i] = None
769
  progress = 90 + ((i + 1) / len(scripts)) * 10
770
- label = f"Generating audio for slide {i + 1}/{len(scripts)}..."
771
  yield (
772
  html_with_progress(label, progress),
773
  file_paths
@@ -793,7 +793,7 @@ Example: 'Received {total_slides} slides, {total_slides} scripts, and HTML files
793
  audio_files.append(audio_file)
794
  audio_urls[i] = get_gradio_file_url(audio_file)
795
  progress = 90 + ((i + 1) / len(scripts)) * 10
796
- label = f"Generating audio for slide {i + 1}/{len(scripts)}..."
797
  file_paths.append(audio_file)
798
  yield (
799
  html_with_progress(label, progress),
@@ -808,7 +808,7 @@ Example: 'Received {total_slides} slides, {total_slides} scripts, and HTML files
808
  audio_files.append(None)
809
  audio_urls[i] = None
810
  progress = 90 + ((i + 1) / len(scripts)) * 10
811
- label = f"Generating audio for slide {i + 1}/{len(scripts)}..."
812
  yield (
813
  html_with_progress(label, progress),
814
  file_paths
 
445
  model_client=model_client,
446
  handoffs=["feynman_agent"],
447
  system_message=f"""
448
+ You are a Script Agent model after Richard Feynman. Access the JSON array of {total_slides} slides from the conversation history, which includes an Introduction slide, {content_slides} content slides, and a Closing slide. Generate a narration script (1-2 sentences) for each of the {total_slides} slides, summarizing its content in a clear, academically inclined tone, with humour as professor feynman would deliver it. Overall keep lecture engaging yet highly informative, covering the fundamental requirements of the topic. Output ONLY a JSON array wrapped in ```json ... ``` with exactly {total_slides} strings, one script per slide, in the same order. Ensure the JSON is valid and complete. After outputting, use the handoff_to_feynman_agent tool. If scripts cannot be generated, retry once.
449
 
450
  - For the Introduction slide, the script should be a welcoming message introducing the lecture.
451
  - For the Closing slide, the script should be a brief farewell and thank you message.
 
658
  elif source == "feynman_agent" and isinstance(message, TextMessage) and "TERMINATE" in message.content:
659
  logger.info("Feynman Agent completed lecture review: %s", message.content)
660
  progress = 90
661
+ label = "Lecture materials ready. Generating lecture speech..."
662
  file_paths = [f for f in os.listdir(OUTPUT_DIR) if f.endswith(('.md', '.txt'))]
663
  file_paths.sort()
664
  file_paths = [os.path.join(OUTPUT_DIR, f) for f in file_paths]
 
767
  audio_files.append(None)
768
  audio_urls[i] = None
769
  progress = 90 + ((i + 1) / len(scripts)) * 10
770
+ label = f"Generating speech for slide {i + 1}/{len(scripts)}..."
771
  yield (
772
  html_with_progress(label, progress),
773
  file_paths
 
793
  audio_files.append(audio_file)
794
  audio_urls[i] = get_gradio_file_url(audio_file)
795
  progress = 90 + ((i + 1) / len(scripts)) * 10
796
+ label = f"Generating speech for slide {i + 1}/{len(scripts)}..."
797
  file_paths.append(audio_file)
798
  yield (
799
  html_with_progress(label, progress),
 
808
  audio_files.append(None)
809
  audio_urls[i] = None
810
  progress = 90 + ((i + 1) / len(scripts)) * 10
811
+ label = f"Generating speech for slide {i + 1}/{len(scripts)}..."
812
  yield (
813
  html_with_progress(label, progress),
814
  file_paths