eaglelandsonce commited on
Commit
4f26484
1 Parent(s): e31036d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -5
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
- # Assuming the file_path is the path to the MP4 file
25
- # You would need to extract audio from the MP4 and then transcribe it
26
- # For simplicity, I'm returning a placeholder text
27
- return "Transcription from uploaded MP4 file goes here."
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)