Spaces:
Sleeping
Sleeping
File size: 3,040 Bytes
4588d9f |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
#!/usr/bin/env python3
"""
Theorem Explanation Agent - Gradio Interface
A web interface for generating educational videos explaining mathematical theorems and concepts.
"""
import gradio as gr
def generate_explanation(topic, context, max_scenes):
"""Generate educational content explanation."""
if not topic.strip():
return "β Please enter a topic to explain"
result = f"""π **Theorem Explanation Agent**
π **Topic:** {topic}
π **Context:** {context if context else "None specified"}
π¬ **Scenes:** {max_scenes}
β
**Demo Generation Complete!**
π― **Generated Educational Content:**
β’ Introduction to {topic}
β’ Fundamental concepts and definitions
β’ Step-by-step mathematical derivation
β’ Visual demonstrations and proofs
β’ Real-world applications and examples
β’ Practice problems and solutions
π **Video Specifications:**
β’ Duration: ~{max_scenes * 0.8:.1f} minutes
β’ Scene count: {max_scenes}
β’ Style: Mathematical animations
β’ Voiceover: AI-generated narration
β οΈ **Demo Mode Active**
This is a simulation showing the interface capabilities.
In production mode, actual Manim animations would be generated.
π **Production Features:**
β Manim mathematical animations
β AI-powered script generation
β Professional voiceover synthesis
β Multiple output formats
β Custom styling and branding
"""
return result
# Define the interface explicitly
iface = gr.Interface(
fn=generate_explanation,
inputs=[
gr.Textbox(
label="π― Mathematical Topic",
placeholder="Enter any mathematical concept (e.g., Pythagorean Theorem, Derivatives, etc.)",
value=""
),
gr.Textbox(
label="π Additional Context",
placeholder="Specify learning level, focus areas, or special requirements (optional)",
value=""
),
gr.Slider(
label="π¬ Number of Video Scenes",
minimum=1,
maximum=8,
value=4,
step=1,
info="More scenes = more detailed explanation"
)
],
outputs=gr.Textbox(
label="π Generated Educational Content",
lines=20,
show_copy_button=True
),
title="π Theorem Explanation Agent",
description="π Generate educational videos explaining mathematical theorems and concepts using AI-powered animations",
examples=[
["Pythagorean Theorem", "Include visual proof and real-world applications", 4],
["Calculus Derivatives", "Focus on geometric interpretation for beginners", 5],
["Newton's Laws of Motion", "Physics applications with practical examples", 3],
["Quadratic Formula", "Step-by-step derivation with examples", 4],
["Probability Distributions", "Visual explanations with real-world data", 5]
],
theme=gr.themes.Soft(),
css="footer {visibility: hidden}"
)
# Export for HF Spaces
demo = iface
if __name__ == "__main__":
demo.launch() |