Fix import issue
Browse files- README.md +92 -34
- app.py +3 -4
- video_accent_analyzer.py +3 -5
README.md
CHANGED
@@ -1,35 +1,93 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
pinned: false
|
10 |
-
---
|
11 |
-
|
12 |
-
# Video Accent Analyzer
|
13 |
-
|
14 |
-
This application analyzes English accents in videos using machine learning. It supports:
|
15 |
-
- YouTube videos
|
16 |
- Loom recordings
|
17 |
-
- Direct video links
|
18 |
-
-
|
19 |
-
|
20 |
-
|
21 |
-
-
|
22 |
-
-
|
23 |
-
-
|
24 |
-
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
-
|
34 |
-
-
|
35 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# ๐ง Video Accent Analyzer
|
2 |
+
|
3 |
+
A sophisticated Python-based tool that analyzes English accents in videos using advanced machine learning techniques. Supports multiple video sources and provides detailed accent analysis with interactive visualizations.
|
4 |
+
|
5 |
+
## ๐ Features
|
6 |
+
|
7 |
+
### Video Support
|
8 |
+
- YouTube videos with browser cookie integration
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
- Loom recordings
|
10 |
+
- Direct MP4 video links
|
11 |
+
- Local video file uploads
|
12 |
+
|
13 |
+
### Accent Analysis
|
14 |
+
- Detects 6 distinct English accents:
|
15 |
+
- ๐ฌ๐ง British English
|
16 |
+
- ๐บ๐ธ American English
|
17 |
+
- ๐ฆ๐บ Australian English
|
18 |
+
- ๐จ๐ฆ Canadian English
|
19 |
+
- ๐ฎ๐ณ Indian English
|
20 |
+
- ๐ Neutral English
|
21 |
+
- Provides confidence scores for accent detection
|
22 |
+
- Assesses English proficiency level
|
23 |
+
- Analyzes audio quality metrics
|
24 |
+
|
25 |
+
### Technical Capabilities
|
26 |
+
- Automatic video download and processing
|
27 |
+
- Audio extraction and preprocessing
|
28 |
+
- Multi-chunk analysis for improved accuracy
|
29 |
+
- Real-time progress tracking
|
30 |
+
- Interactive Plotly visualizations
|
31 |
+
- Batch processing support
|
32 |
+
|
33 |
+
## ๐ Installation
|
34 |
+
|
35 |
+
```bash
|
36 |
+
pip install -r requirements.txt
|
37 |
+
|
38 |
+
```
|
39 |
+
# ๐ป Usage
|
40 |
+
Web Interface
|
41 |
+
Start the application:
|
42 |
+
python app.py
|
43 |
+
Open the provided URL in your browser
|
44 |
+
Enter a video URL or upload a video file
|
45 |
+
Adjust the maximum duration (10-120 seconds)
|
46 |
+
Click "Analyze Video"
|
47 |
+
|
48 |
+
# Python API
|
49 |
+
```from video_accent_analyzer import VideoAccentAnalyzer
|
50 |
+
|
51 |
+
# Initialize analyzer
|
52 |
+
analyzer = VideoAccentAnalyzer()
|
53 |
+
|
54 |
+
# Analyze video
|
55 |
+
results = analyzer.analyze_video_url("your_video_url", max_duration=30)
|
56 |
+
|
57 |
+
# Display results
|
58 |
+
analyzer.display_results(results)
|
59 |
+
```
|
60 |
+
|
61 |
+
# โ๏ธ Technical Requirements
|
62 |
+
Python 3.7+
|
63 |
+
FFmpeg installed on system
|
64 |
+
Required Python packages:
|
65 |
+
gradio โฅ4.0.0
|
66 |
+
plotly โฅ5.0.0
|
67 |
+
torch
|
68 |
+
transformers
|
69 |
+
librosa
|
70 |
+
soundfile
|
71 |
+
yt-dlp
|
72 |
+
browser-cookie3 โฅ0.19.1
|
73 |
+
|
74 |
+
## ๐ Results
|
75 |
+
๐ฏ Best Practices
|
76 |
+
- Use videos with clear audio and minimal background noise
|
77 |
+
For Best Results
|
78 |
+
Use videos under 2 minutes in length
|
79 |
+
Ensure clear audio quality
|
80 |
+
Single speaker per analysis
|
81 |
+
Continuous speech segments
|
82 |
+
Minimum background noise
|
83 |
+
Known Limitations
|
84 |
+
Multiple speakers may affect accuracy
|
85 |
+
Heavy background noise can impact results
|
86 |
+
Very short speech segments (<10s) may be less accurate
|
87 |
+
Some region-restricted videos might not be accessible
|
88 |
+
|
89 |
+
# ๐ง Development
|
90 |
+
The project consists of three main components:
|
91 |
+
video_accent_analyzer.py: Core analysis engine
|
92 |
+
app.py: Gradio web interface
|
93 |
+
Supporting utilities for video processing
|
app.py
CHANGED
@@ -103,7 +103,7 @@ with gr.Blocks(css=css) as interface:
|
|
103 |
# ๐ง Video Accent Analyzer
|
104 |
|
105 |
Analyze English accents in videos from various sources:
|
106 |
-
-
|
107 |
- Loom recordings
|
108 |
- Direct video links
|
109 |
- Uploaded video files
|
@@ -118,7 +118,7 @@ with gr.Blocks(css=css) as interface:
|
|
118 |
with gr.Column():
|
119 |
url_input = gr.Textbox(
|
120 |
label="Video URL",
|
121 |
-
placeholder="Enter
|
122 |
)
|
123 |
video_input = gr.File(
|
124 |
label="Or Upload Video",
|
@@ -145,8 +145,7 @@ with gr.Blocks(css=css) as interface:
|
|
145 |
|
146 |
gr.Examples(
|
147 |
examples=[
|
148 |
-
["https://www.
|
149 |
-
["https://www.youtube.com/watch?v=YQHsXMglC9A", None, 30],
|
150 |
],
|
151 |
inputs=[url_input, video_input, duration],
|
152 |
outputs=[output_text, output_plot],
|
|
|
103 |
# ๐ง Video Accent Analyzer
|
104 |
|
105 |
Analyze English accents in videos from various sources:
|
106 |
+
- MP4 videos
|
107 |
- Loom recordings
|
108 |
- Direct video links
|
109 |
- Uploaded video files
|
|
|
118 |
with gr.Column():
|
119 |
url_input = gr.Textbox(
|
120 |
label="Video URL",
|
121 |
+
placeholder="Enter , Loom, or direct video URL"
|
122 |
)
|
123 |
video_input = gr.File(
|
124 |
label="Or Upload Video",
|
|
|
145 |
|
146 |
gr.Examples(
|
147 |
examples=[
|
148 |
+
["https://www.loom.com/share/7b82b3e25ec8409a8e4b5568e95dca5c?sid=e0819070-d2ba-4236-a7a0-878c8739040f", None, 30],
|
|
|
149 |
],
|
150 |
inputs=[url_input, video_input, duration],
|
151 |
outputs=[output_text, output_plot],
|
video_accent_analyzer.py
CHANGED
@@ -649,10 +649,9 @@ def cleanup(self):
|
|
649 |
def show_examples():
|
650 |
"""Show usage examples"""
|
651 |
examples = {
|
652 |
-
"YouTube": "https://youtube.com/watch?v=abc123",
|
653 |
"Loom": "https://www.loom.com/share/abc123def456",
|
654 |
"Direct MP4": "https://example.com/video.mp4",
|
655 |
-
"Local File": "/
|
656 |
}
|
657 |
|
658 |
print("\n๐ฏ Supported Video Formats:")
|
@@ -669,13 +668,12 @@ def show_examples():
|
|
669 |
def quick_test_url():
|
670 |
"""Interactive test for video URLs"""
|
671 |
print("๐ Quick Test Mode for Video URLs")
|
672 |
-
print("๐ฏ Supported:
|
673 |
print("๐ก Examples:")
|
674 |
-
print(" YouTube: https://youtube.com/watch?v=VIDEO_ID")
|
675 |
print(" Loom: https://www.loom.com/share/VIDEO_ID")
|
676 |
print(" Direct: https://example.com/video.mp4")
|
677 |
|
678 |
-
url = input("\n๐ Enter your video URL (Loom,
|
679 |
if not url:
|
680 |
print("โ No URL provided.")
|
681 |
return None
|
|
|
649 |
def show_examples():
|
650 |
"""Show usage examples"""
|
651 |
examples = {
|
|
|
652 |
"Loom": "https://www.loom.com/share/abc123def456",
|
653 |
"Direct MP4": "https://example.com/video.mp4",
|
654 |
+
"Local File": "/local/input/dataset/video.mp4"
|
655 |
}
|
656 |
|
657 |
print("\n๐ฏ Supported Video Formats:")
|
|
|
668 |
def quick_test_url():
|
669 |
"""Interactive test for video URLs"""
|
670 |
print("๐ Quick Test Mode for Video URLs")
|
671 |
+
print("๐ฏ Supported: Loom, Direct MP4 links")
|
672 |
print("๐ก Examples:")
|
|
|
673 |
print(" Loom: https://www.loom.com/share/VIDEO_ID")
|
674 |
print(" Direct: https://example.com/video.mp4")
|
675 |
|
676 |
+
url = input("\n๐ Enter your video URL (Loom, MP4 , etc.): ").strip()
|
677 |
if not url:
|
678 |
print("โ No URL provided.")
|
679 |
return None
|