Add application file
Browse files- .idea/.gitignore +8 -0
- .idea/detect_English_language_speaking.iml +8 -0
- .idea/inspectionProfiles/profiles_settings.xml +6 -0
- .idea/misc.xml +7 -0
- .idea/modules.xml +8 -0
- .idea/vcs.xml +6 -0
- VideoAccentAnalyzer.py +0 -0
- app.py +51 -0
- requirements.txt +0 -0
- setup.sh +0 -0
.idea/.gitignore
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Default ignored files
|
2 |
+
/shelf/
|
3 |
+
/workspace.xml
|
4 |
+
# Editor-based HTTP Client requests
|
5 |
+
/httpRequests/
|
6 |
+
# Datasource local storage ignored files
|
7 |
+
/dataSources/
|
8 |
+
/dataSources.local.xml
|
.idea/detect_English_language_speaking.iml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<module type="PYTHON_MODULE" version="4">
|
3 |
+
<component name="NewModuleRootManager">
|
4 |
+
<content url="file://$MODULE_DIR$" />
|
5 |
+
<orderEntry type="inheritedJdk" />
|
6 |
+
<orderEntry type="sourceFolder" forTests="false" />
|
7 |
+
</component>
|
8 |
+
</module>
|
.idea/inspectionProfiles/profiles_settings.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<component name="InspectionProjectProfileManager">
|
2 |
+
<settings>
|
3 |
+
<option name="USE_PROJECT_PROFILE" value="false" />
|
4 |
+
<version value="1.0" />
|
5 |
+
</settings>
|
6 |
+
</component>
|
.idea/misc.xml
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="Black">
|
4 |
+
<option name="sdkName" value="Python 3.10 (resume_processor)" />
|
5 |
+
</component>
|
6 |
+
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10 (resume_processor)" project-jdk-type="Python SDK" />
|
7 |
+
</project>
|
.idea/modules.xml
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="ProjectModuleManager">
|
4 |
+
<modules>
|
5 |
+
<module fileurl="file://$PROJECT_DIR$/.idea/detect_English_language_speaking.iml" filepath="$PROJECT_DIR$/.idea/detect_English_language_speaking.iml" />
|
6 |
+
</modules>
|
7 |
+
</component>
|
8 |
+
</project>
|
.idea/vcs.xml
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
+
<project version="4">
|
3 |
+
<component name="VcsDirectoryMappings">
|
4 |
+
<mapping directory="" vcs="Git" />
|
5 |
+
</component>
|
6 |
+
</project>
|
VideoAccentAnalyzer.py
ADDED
File without changes
|
app.py
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from VideoAccentAnalyzer import VideoAccentAnalyzer
|
3 |
+
import ffmpeg
|
4 |
+
import os
|
5 |
+
|
6 |
+
analyzer = VideoAccentAnalyzer()
|
7 |
+
|
8 |
+
|
9 |
+
def analyze_video(url=None, video_file=None):
|
10 |
+
if url:
|
11 |
+
result = analyzer.analyze_video_url(url)
|
12 |
+
elif video_file:
|
13 |
+
result = analyzer.analyze_local_video(video_file)
|
14 |
+
else:
|
15 |
+
return "Please provide a video URL or upload a file"
|
16 |
+
|
17 |
+
if 'error' in result:
|
18 |
+
return f"β Error: {result['error']}"
|
19 |
+
|
20 |
+
# Format results as markdown
|
21 |
+
markdown = f"## π― Results\n"
|
22 |
+
markdown += f"**Predicted Accent:** {result['predicted_accent']}\n"
|
23 |
+
markdown += f"**Confidence:** {result['accent_confidence']:.1f}%\n"
|
24 |
+
markdown += f"**English Confidence:** {result['english_confidence']:.1f}%\n\n"
|
25 |
+
markdown += "### π Probability Breakdown:\n"
|
26 |
+
|
27 |
+
for accent, prob in sorted(result['all_probabilities'].items(),
|
28 |
+
key=lambda x: x[1], reverse=True):
|
29 |
+
markdown += f"- {accent}: {prob:.1f}%\n"
|
30 |
+
|
31 |
+
return markdown
|
32 |
+
|
33 |
+
|
34 |
+
# Create Gradio interface
|
35 |
+
interface = gr.Interface(
|
36 |
+
fn=analyze_video,
|
37 |
+
inputs=[
|
38 |
+
gr.Textbox(label="Video URL (YouTube/Loom/Direct MP4)"),
|
39 |
+
gr.File(label="Or Upload Video File", type="filepath")
|
40 |
+
],
|
41 |
+
outputs=gr.Markdown(label="Analysis Results"),
|
42 |
+
examples=[
|
43 |
+
["https://www.youtube.com/watch?v=NO5SbsvIjHE ", None],
|
44 |
+
[None, "/kaggle/input/test-video.mp4"]
|
45 |
+
],
|
46 |
+
title="π§ Video Accent Analyzer",
|
47 |
+
description="Analyze accents in videos from YouTube, Loom, or uploaded files. Supports English accents only."
|
48 |
+
)
|
49 |
+
|
50 |
+
if __name__ == "__main__":
|
51 |
+
interface.launch()
|
requirements.txt
ADDED
File without changes
|
setup.sh
ADDED
File without changes
|