Jaward commited on
Commit
d2c2f81
·
verified ·
1 Parent(s): 92c2824

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -334,7 +334,7 @@ async def on_generate(api_service, api_key, serpapi_key, title, topic, instructi
334
  model_client=model_client,
335
  handoffs=["slide_agent"],
336
  system_message="You are a Research Agent. Use the search_web tool to gather information on the topic and keywords from the initial message. Summarize the findings concisely in a single message, then use the handoff_to_slide_agent tool to pass the task to the Slide Agent. Do not produce any other output.",
337
- tools=[{"function": search_web, "name": "search_web", "description": "Search the web using SerpApi", "parameters": {"query": {"type": "string"}, "serpapi_key": {"type": "string"}} }]
338
  )
339
  slide_agent = AssistantAgent(
340
  name="slide_agent",
@@ -359,7 +359,7 @@ Example output:
359
  model_client=model_client,
360
  handoffs=["feynman_agent"],
361
  system_message=f"""
362
- You are a Script Agent. Access the JSON array of {num_slides + 3} slides from_synced the conversation history. Generate a narration script (1-2 sentences) for each slide, summarizing its content. Output ONLY a JSON array wrapped in ```json ... ``` with exactly {num_slides + 3} 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.
363
  Example for 1 content slide:
364
  ```json
365
  [
@@ -776,6 +776,7 @@ with gr.Blocks(title="Agent Feynman") as demo:
776
  serpapi_key = gr.Textbox(label="SerpApi Key", type="password", placeholder="Enter your SerpApi key")
777
  num_slides = gr.Slider(1, 20, step=1, label="Number of Content Slides", value=3)
778
  speaker_audio = gr.Audio(label="Speaker sample audio (MP3 or WAV)", type="filepath", elem_id="speaker-audio")
 
779
  generate_btn = gr.Button("Generate Lecture")
780
  with gr.Column(scale=2):
781
  default_slide_html = """
@@ -788,7 +789,8 @@ with gr.Blocks(title="Agent Feynman") as demo:
788
 
789
  speaker_audio.change(
790
  fn=update_audio_preview,
791
- inputs=speaker_audio
 
792
  )
793
 
794
  generate_btn.click(
 
334
  model_client=model_client,
335
  handoffs=["slide_agent"],
336
  system_message="You are a Research Agent. Use the search_web tool to gather information on the topic and keywords from the initial message. Summarize the findings concisely in a single message, then use the handoff_to_slide_agent tool to pass the task to the Slide Agent. Do not produce any other output.",
337
+ tools=[search_web]
338
  )
339
  slide_agent = AssistantAgent(
340
  name="slide_agent",
 
359
  model_client=model_client,
360
  handoffs=["feynman_agent"],
361
  system_message=f"""
362
+ You are a Script Agent. Access the JSON array of {num_slides + 3} slides from the conversation history. Generate a narration script (1-2 sentences) for each slide, summarizing its content. Output ONLY a JSON array wrapped in ```json ... ``` with exactly {num_slides + 3} 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.
363
  Example for 1 content slide:
364
  ```json
365
  [
 
776
  serpapi_key = gr.Textbox(label="SerpApi Key", type="password", placeholder="Enter your SerpApi key")
777
  num_slides = gr.Slider(1, 20, step=1, label="Number of Content Slides", value=3)
778
  speaker_audio = gr.Audio(label="Speaker sample audio (MP3 or WAV)", type="filepath", elem_id="speaker-audio")
779
+ audio_preview = gr.Audio(label="Audio Preview", interactive=False)
780
  generate_btn = gr.Button("Generate Lecture")
781
  with gr.Column(scale=2):
782
  default_slide_html = """
 
789
 
790
  speaker_audio.change(
791
  fn=update_audio_preview,
792
+ inputs=speaker_audio,
793
+ outputs=audio_preview
794
  )
795
 
796
  generate_btn.click(