ujwal55 commited on
Commit
525f7f2
Β·
1 Parent(s): c1d21ce

Updated app.y READM.md file

Browse files
Files changed (2) hide show
  1. README.md +30 -27
  2. app.py +17 -21
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 Chapter Video Generator 🎬
30
 
31
- An automated tool that creates engaging physics educational videos by combining title cards with relevant YouTube content.
32
 
33
  ## Features
34
 
35
- - πŸ“ **Smart Topic Extraction**: Supports numbered lists, markdown headers, and plain text
36
- - 🎨 **Dynamic Title Cards**: Auto-generated cards with proper text wrapping
37
- - πŸ” **Intelligent Video Search**: Finds relevant physics videos for each topic
38
- - 🎬 **Seamless Concatenation**: Combines everything into one cohesive video
39
- - ⚑ **Optimized for Spaces**: Fast processing with resource-conscious settings
40
 
41
- ## How to Use
42
 
43
- 1. Enter your physics chapter topics (one per line)
44
- 2. Click "Generate Physics Video"
45
- 3. Wait 2-5 minutes for processing
46
- 4. Download your custom physics video!
47
 
48
- ## Input Formats Supported
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
- WAVE MOTION
64
- SOUND WAVES
65
- ELECTROMAGNETIC WAVES
66
  ```
67
 
68
- ## Technical Details
69
 
70
- - Built with Gradio for easy web interface
71
- - Uses FFmpeg for video processing
72
- - yt-dlp for YouTube video downloading
73
- - Optimized encoding settings for web deployment
74
- - Resource limits: 8 topics max, 30s per video clip
75
 
76
  ## Limitations
77
 
78
- - Processing time depends on video availability
79
- - Quality optimized for fast generation
80
- - Limited to publicly available YouTube content
81
- - Designed for educational use
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
- Fast Physics-Chapter Visual Explainer for Hugging Face Spaces
4
- β€’ Downloads best audio+video for each topic
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
- """Main function to create physics video"""
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
- """Create Gradio interface"""
215
  with gr.Blocks(title="Physics Video Generator", theme=gr.themes.Soft()) as app:
216
  gr.Markdown("""
217
- # 🎬 Physics Chapter Video Generator
218
 
219
- Create engaging physics videos by entering chapter topics! The app will:
220
- - Generate title cards for each topic
221
- - Search for relevant physics videos
222
- - Combine everything into one cohesive video
223
 
224
- **Input Format:** Enter topics one per line, or use numbered lists, or markdown headers.
225
  """)
226
 
227
  with gr.Row():
@@ -243,17 +239,17 @@ Or:
243
  max_lines=15
244
  )
245
 
246
- generate_btn = gr.Button("🎬 Generate Physics Video", variant="primary", size="lg")
247
 
248
  with gr.Column():
249
- video_output = gr.Video(label="Generated Video")
250
 
251
  gr.Markdown("""
252
- ### ⚠️ Note:
253
- - Processing may take 2-5 minutes depending on topic count
254
- - Videos are optimized for fast generation
255
- - Maximum 8 topics per video
256
- - Each video clip is limited to 30 seconds
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(