Updated app.y READM.md file
Browse files
README.md
CHANGED
@@ -15,7 +15,7 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
15 |
|
16 |
---
|
17 |
title: Physics Video Generator
|
18 |
-
emoji:
|
19 |
colorFrom: blue
|
20 |
colorTo: purple
|
21 |
sdk: gradio
|
@@ -26,57 +26,60 @@ license: mit
|
|
26 |
python_version: 3.11
|
27 |
---
|
28 |
|
29 |
-
# Physics
|
30 |
|
31 |
-
|
32 |
|
33 |
## Features
|
34 |
|
35 |
-
-
|
36 |
-
-
|
37 |
-
-
|
38 |
-
-
|
39 |
-
-
|
40 |
|
41 |
-
##
|
42 |
|
43 |
-
1. Enter your physics
|
44 |
-
2. Click "
|
45 |
-
3. Wait
|
46 |
-
4. Download your
|
47 |
|
48 |
-
## Input Formats
|
49 |
|
|
|
50 |
```
|
51 |
1. Newton's Laws of Motion
|
52 |
2. Force and Acceleration
|
53 |
3. Energy Conservation
|
54 |
```
|
55 |
|
|
|
56 |
```
|
57 |
# Kinematics
|
58 |
# Dynamics
|
59 |
# Thermodynamics
|
60 |
```
|
61 |
|
|
|
62 |
```
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
```
|
67 |
|
68 |
-
## Technical
|
69 |
|
70 |
-
- Built with
|
71 |
-
-
|
72 |
-
-
|
73 |
-
-
|
74 |
-
-
|
75 |
|
76 |
## Limitations
|
77 |
|
78 |
-
- Processing time
|
79 |
-
-
|
80 |
-
-
|
81 |
-
-
|
82 |
|
|
|
15 |
|
16 |
---
|
17 |
title: Physics Video Generator
|
18 |
+
emoji: π
|
19 |
colorFrom: blue
|
20 |
colorTo: purple
|
21 |
sdk: gradio
|
|
|
26 |
python_version: 3.11
|
27 |
---
|
28 |
|
29 |
+
# Physics Video Generator
|
30 |
|
31 |
+
A tool for creating educational physics videos by combining topic slides with relevant educational content.
|
32 |
|
33 |
## Features
|
34 |
|
35 |
+
- **Topic Processing**: Handles various input formats including numbered lists and headers
|
36 |
+
- **Educational Slides**: Creates clean title slides for each physics topic
|
37 |
+
- **Content Integration**: Finds and incorporates relevant educational videos
|
38 |
+
- **Video Compilation**: Produces a single comprehensive video file
|
39 |
+
- **Web Interface**: Easy-to-use browser-based interface
|
40 |
|
41 |
+
## Usage
|
42 |
|
43 |
+
1. Enter your physics topics in the text area
|
44 |
+
2. Click "Create Physics Video"
|
45 |
+
3. Wait for processing to complete
|
46 |
+
4. Download your educational video
|
47 |
|
48 |
+
## Supported Input Formats
|
49 |
|
50 |
+
Numbered lists:
|
51 |
```
|
52 |
1. Newton's Laws of Motion
|
53 |
2. Force and Acceleration
|
54 |
3. Energy Conservation
|
55 |
```
|
56 |
|
57 |
+
Headers:
|
58 |
```
|
59 |
# Kinematics
|
60 |
# Dynamics
|
61 |
# Thermodynamics
|
62 |
```
|
63 |
|
64 |
+
Plain text:
|
65 |
```
|
66 |
+
Wave Motion
|
67 |
+
Sound Waves
|
68 |
+
Electromagnetic Waves
|
69 |
```
|
70 |
|
71 |
+
## Technical Specifications
|
72 |
|
73 |
+
- Built with modern web technologies
|
74 |
+
- Video processing handled server-side
|
75 |
+
- Supports multiple physics topics per video
|
76 |
+
- Educational content sourcing from public videos
|
77 |
+
- Optimized for web delivery
|
78 |
|
79 |
## Limitations
|
80 |
|
81 |
+
- Processing time varies based on content availability
|
82 |
+
- Limited to publicly available educational resources
|
83 |
+
- Designed specifically for physics education
|
84 |
+
- Maximum of 8 topics per video session
|
85 |
|
app.py
CHANGED
@@ -1,10 +1,6 @@
|
|
1 |
-
#!/usr/bin/env python3
|
2 |
"""
|
3 |
-
|
4 |
-
|
5 |
-
β’ Generates title cards with FFmpeg drawtext (+ silent audio)
|
6 |
-
β’ Concatenates everything in a single FFmpeg pass
|
7 |
-
β’ Optimized for HF Spaces with Gradio interface
|
8 |
"""
|
9 |
|
10 |
import re, shutil, subprocess, textwrap, os, tempfile
|
@@ -115,7 +111,7 @@ def extract_topics(text: str) -> List[str]:
|
|
115 |
return topics[:MAX_TOPICS]
|
116 |
|
117 |
def create_physics_video(chapter_text: str, progress=gr.Progress()) -> Optional[str]:
|
118 |
-
"""
|
119 |
if not chapter_text.strip():
|
120 |
return None
|
121 |
|
@@ -211,17 +207,17 @@ def create_physics_video(chapter_text: str, progress=gr.Progress()) -> Optional[
|
|
211 |
|
212 |
# Gradio Interface
|
213 |
def create_interface():
|
214 |
-
"""
|
215 |
with gr.Blocks(title="Physics Video Generator", theme=gr.themes.Soft()) as app:
|
216 |
gr.Markdown("""
|
217 |
-
#
|
218 |
|
219 |
-
|
220 |
-
-
|
221 |
-
-
|
222 |
-
- Combine everything into
|
223 |
|
224 |
-
**
|
225 |
""")
|
226 |
|
227 |
with gr.Row():
|
@@ -243,17 +239,17 @@ Or:
|
|
243 |
max_lines=15
|
244 |
)
|
245 |
|
246 |
-
generate_btn = gr.Button("
|
247 |
|
248 |
with gr.Column():
|
249 |
-
video_output = gr.Video(label="
|
250 |
|
251 |
gr.Markdown("""
|
252 |
-
###
|
253 |
-
- Processing
|
254 |
-
- Videos are optimized for
|
255 |
-
-
|
256 |
-
- Each video
|
257 |
""")
|
258 |
|
259 |
generate_btn.click(
|
|
|
|
|
1 |
"""
|
2 |
+
Physics Chapter Video Generator
|
3 |
+
Creates educational videos by combining title cards with relevant content.
|
|
|
|
|
|
|
4 |
"""
|
5 |
|
6 |
import re, shutil, subprocess, textwrap, os, tempfile
|
|
|
111 |
return topics[:MAX_TOPICS]
|
112 |
|
113 |
def create_physics_video(chapter_text: str, progress=gr.Progress()) -> Optional[str]:
|
114 |
+
"""Generate educational physics video from chapter topics"""
|
115 |
if not chapter_text.strip():
|
116 |
return None
|
117 |
|
|
|
207 |
|
208 |
# Gradio Interface
|
209 |
def create_interface():
|
210 |
+
"""Setup the web interface"""
|
211 |
with gr.Blocks(title="Physics Video Generator", theme=gr.themes.Soft()) as app:
|
212 |
gr.Markdown("""
|
213 |
+
# Physics Video Generator
|
214 |
|
215 |
+
Transform your physics topics into engaging educational videos! This tool will:
|
216 |
+
- Create professional title slides for each topic
|
217 |
+
- Find relevant educational content
|
218 |
+
- Combine everything into a complete video
|
219 |
|
220 |
+
**How to use:** Enter your topics one per line, or use numbered lists, or markdown headers.
|
221 |
""")
|
222 |
|
223 |
with gr.Row():
|
|
|
239 |
max_lines=15
|
240 |
)
|
241 |
|
242 |
+
generate_btn = gr.Button("Create Physics Video", variant="primary", size="lg")
|
243 |
|
244 |
with gr.Column():
|
245 |
+
video_output = gr.Video(label="Your Physics Video")
|
246 |
|
247 |
gr.Markdown("""
|
248 |
+
### Important Notes:
|
249 |
+
- Processing typically takes 2-5 minutes
|
250 |
+
- Videos are optimized for educational use
|
251 |
+
- Limited to 8 topics per session
|
252 |
+
- Each video segment is capped at 30 seconds
|
253 |
""")
|
254 |
|
255 |
generate_btn.click(
|