Spaces:
Sleeping
Sleeping
eaglelandsonce
commited on
Commit
•
4f26484
1
Parent(s):
e31036d
Update app.py
Browse files
app.py
CHANGED
@@ -21,11 +21,16 @@ def get_text_from_url(url):
|
|
21 |
return result['text']
|
22 |
|
23 |
def get_text_from_file(file_path):
|
24 |
-
#
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
29 |
def get_summary(url):
|
30 |
article = get_text_from_url(url)
|
31 |
b = summarizer(article)
|
|
|
21 |
return result['text']
|
22 |
|
23 |
def get_text_from_file(file_path):
|
24 |
+
# Extract audio from the MP4 file
|
25 |
+
video = VideoFileClip(file_path)
|
26 |
+
audio_path = file_path.replace(".mp4", ".mp3")
|
27 |
+
video.audio.write_audiofile(audio_path)
|
28 |
+
# Transcribe the audio
|
29 |
+
result = model.transcribe(audio_path)
|
30 |
+
# Optionally, remove the audio file after transcription
|
31 |
+
os.remove(audio_path)
|
32 |
+
return result['text']
|
33 |
+
|
34 |
def get_summary(url):
|
35 |
article = get_text_from_url(url)
|
36 |
b = summarizer(article)
|