Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -369,7 +369,7 @@ async def update_audio_preview(audio_file):
|
|
369 |
|
370 |
# Create a zip file of .md, .txt, and .mp3 files
|
371 |
def create_zip_of_files(file_paths):
|
372 |
-
zip_path = os.path.join(OUTPUT_DIR, "
|
373 |
with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
374 |
for file_path in file_paths:
|
375 |
if os.path.exists(file_path):
|
@@ -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 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.
|
@@ -951,9 +951,9 @@ js_code = """
|
|
951 |
const textLength = body.textContent.length;
|
952 |
const screenWidth = window.innerWidth;
|
953 |
// Base font size: 12px max on large screens, scale down to 8px on small screens
|
954 |
-
let baseFontSize = Math.min(12, Math.max(
|
955 |
// Adjust inversely with content length
|
956 |
-
const adjustedFontSize = Math.max(
|
957 |
const elements = body.getElementsByTagName('*');
|
958 |
for (let elem of elements) {
|
959 |
elem.style.fontSize = `${adjustedFontSize}px`;
|
|
|
369 |
|
370 |
# Create a zip file of .md, .txt, and .mp3 files
|
371 |
def create_zip_of_files(file_paths):
|
372 |
+
zip_path = os.path.join(OUTPUT_DIR, "all_lecture_materials.zip")
|
373 |
with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
374 |
for file_path in file_paths:
|
375 |
if os.path.exists(file_path):
|
|
|
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. Ensure the lecture is engaging and covers the fundamental requirements of the topic. 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.
|
|
|
951 |
const textLength = body.textContent.length;
|
952 |
const screenWidth = window.innerWidth;
|
953 |
// Base font size: 12px max on large screens, scale down to 8px on small screens
|
954 |
+
let baseFontSize = Math.min(12, Math.max(12, 16 * (screenWidth / 1920))); // Scale with screen width (1920px as reference)
|
955 |
// Adjust inversely with content length
|
956 |
+
const adjustedFontSize = Math.max(12, baseFontSize * (1000 / (textLength + 100))); // Minimum 8px, scale down with length
|
957 |
const elements = body.getElementsByTagName('*');
|
958 |
for (let elem of elements) {
|
959 |
elem.style.fontSize = `${adjustedFontSize}px`;
|