ferhatbou commited on
Commit
98a96df
ยท
1 Parent(s): 521d529

Fix import issue

Browse files
Files changed (3) hide show
  1. README.md +92 -34
  2. app.py +3 -4
  3. video_accent_analyzer.py +3 -5
README.md CHANGED
@@ -1,35 +1,93 @@
1
- ---
2
- title: Video Accent Analyzer
3
- emoji: ๐ŸŽง
4
- colorFrom: green
5
- colorTo: blue
6
- sdk: gradio
7
- sdk_version: 4.0.0
8
- app_file: app.py
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
- - Uploaded video files
19
-
20
- ## Features
21
- - Accent detection with confidence scores
22
- - English proficiency assessment
23
- - Interactive visualizations
24
- - Support for multiple video sources
25
-
26
- ## Usage
27
- 1. Enter a video URL or upload a video file
28
- 2. Set the maximum duration to analyze
29
- 3. Click "Analyze Video"
30
- 4. View the detailed results and visualization
31
-
32
- ## Tips
33
- - Keep videos under 2 minutes for best results
34
- - Ensure clear audio quality
35
- - Multiple speakers may affect accuracy
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
- - YouTube videos
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 YouTube, Loom, or direct video URL"
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.youtube.com/watch?v=NO5SbsvIjHE", None, 30],
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": "/kaggle/input/dataset/video.mp4"
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: YouTube, Loom, Direct MP4 links")
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, YouTube, etc.): ").strip()
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