mirror of
https://github.com/openai/whisper.git
synced 2025-11-24 14:35:57 +00:00
Merge 3c00eb610d4e7845c3492984041790bcb7d48896 into ba3f3cd54b0e5b8ce1ab3de13e32122d0d5f98ab
This commit is contained in:
commit
e73c9adac0
57
src/blackbox_m_test.py
Normal file
57
src/blackbox_m_test.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
# Import necessary libraries
|
||||||
|
import os
|
||||||
|
import glob
|
||||||
|
import sqlite3
|
||||||
|
from whisper import Whisper
|
||||||
|
|
||||||
|
# Initialize Whisper model
|
||||||
|
model = Whisper()
|
||||||
|
|
||||||
|
# Function to transcribe audio file
|
||||||
|
def transcribe_audio(audio_file):
|
||||||
|
transcription = model.transcribe(audio_file)
|
||||||
|
return transcription
|
||||||
|
|
||||||
|
# Function to extract audio from video file
|
||||||
|
def extract_audio(video_file, output_path):
|
||||||
|
# Use ffmpeg to extract audio from video
|
||||||
|
os.system(f'ffmpeg -i {video_file} -vn -ab 256 {output_path}')
|
||||||
|
|
||||||
|
# Function to log file paths and transcriptions
|
||||||
|
def log_file(file_path, transcription):
|
||||||
|
# Connect to SQLite database
|
||||||
|
conn = sqlite3.connect('files.db')
|
||||||
|
c = conn.cursor()
|
||||||
|
|
||||||
|
# Create table if it doesn't exist
|
||||||
|
c.execute('''CREATE TABLE IF NOT EXISTS files
|
||||||
|
(file_path TEXT PRIMARY KEY, transcription TEXT)''')
|
||||||
|
|
||||||
|
# Insert file path and transcription into table
|
||||||
|
c.execute("INSERT OR REPLACE INTO files (file_path, transcription) VALUES (?,?)", (file_path, transcription))
|
||||||
|
|
||||||
|
# Commit changes and close connection
|
||||||
|
conn.commit()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
|
# Get list of video and audio files in directories
|
||||||
|
video_files = []
|
||||||
|
audio_files = []
|
||||||
|
for dirpath, dirnames, filenames in os.walk('C:\\Users\\lundg\\Videos'):
|
||||||
|
for filename in filenames:
|
||||||
|
if filename.endswith('.mp4') or filename.endswith('.avi') or filename.endswith('.mkv'):
|
||||||
|
video_files.append(os.path.join(dirpath, filename))
|
||||||
|
elif filename.endswith('.mp3') or filename.endswith('.wav'):
|
||||||
|
audio_files.append(os.path.join(dirpath, filename))
|
||||||
|
|
||||||
|
# Extract audio from video files and transcribe
|
||||||
|
for video_file in video_files:
|
||||||
|
audio_path = os.path.join(os.path.dirname(video_file), 'audio_' + os.path.basename(video_file))
|
||||||
|
extract_audio(video_file, audio_path)
|
||||||
|
transcription = transcribe_audio(audio_path)
|
||||||
|
log_file(video_file, transcription)
|
||||||
|
|
||||||
|
# Transcribe existing audio files
|
||||||
|
for audio_file in audio_files:
|
||||||
|
transcription = transcribe_audio(audio_file)
|
||||||
|
log_file(audio_file, transcription)
|
||||||
30
src/claude_eval.py
Normal file
30
src/claude_eval.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
#declare each video path to track down captures
|
||||||
|
#specific folders to monitor:
|
||||||
|
# C:\Users\lundg\Videos\Captures
|
||||||
|
# "C:\Users\lundg\Videos\Clip Champ"
|
||||||
|
# "C:\Users\lundg\Videos\Call of Duty Modern Warfare 3 (2023)"
|
||||||
|
# "C:\Users\lundg\Videos\Desktop"
|
||||||
|
# "C:\Users\lundg\Videos\SteelSeries Moments"
|
||||||
|
# "C:\Users\lundg\Videos\Captures"
|
||||||
|
# "C:\Users\lundg\Videos\Fortnite"
|
||||||
|
# "C:\Users\lundg\Videos\RealVNC"
|
||||||
|
|
||||||
|
#essentially any picture of video under C://Users//lundg//Videoo
|
||||||
|
|
||||||
|
# pictures, audio files and video files(and paths) need to be logged for of all files(videos and pictures in this directories) and store them in a list
|
||||||
|
#each file that is tracked with an object should also be logged in a db?
|
||||||
|
|
||||||
|
|
||||||
|
#figure out how to separate audio from video files via an api or cli
|
||||||
|
|
||||||
|
#example extract audio from video.mp4 and save it as audio.mp3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#user can select a audio file and transcribe it with whisper
|
||||||
|
|
||||||
|
#figure out how to design a gui in vscode that can front end this
|
||||||
|
#
|
||||||
30
src/copilot.py
Normal file
30
src/copilot.py
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
|
||||||
|
#declare each video path to track down captures
|
||||||
|
#specific folders to monitor:
|
||||||
|
# C:\Users\lundg\Videos\Captures
|
||||||
|
# "C:\Users\lundg\Videos\Clip Champ"
|
||||||
|
# "C:\Users\lundg\Videos\Call of Duty Modern Warfare 3 (2023)"
|
||||||
|
# "C:\Users\lundg\Videos\Desktop"
|
||||||
|
# "C:\Users\lundg\Videos\SteelSeries Moments"
|
||||||
|
# "C:\Users\lundg\Videos\Captures"
|
||||||
|
# "C:\Users\lundg\Videos\Fortnite"
|
||||||
|
# "C:\Users\lundg\Videos\RealVNC"
|
||||||
|
|
||||||
|
#essentially any picture of video under C://Users//lundg//Videoo
|
||||||
|
|
||||||
|
# pictures, audio files and video files(and paths) need to be logged for of all files(videos and pictures in this directories) and store them in a list
|
||||||
|
#each file that is tracked with an object should also be logged in a db?
|
||||||
|
|
||||||
|
|
||||||
|
#figure out how to separate audio from video files via an api or cli
|
||||||
|
|
||||||
|
#example extract audio from video.mp4 and save it as audio.mp3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#user can select a audio file and transcribe it with whisper
|
||||||
|
|
||||||
|
#figure out how to design a gui in vscode that can front end this
|
||||||
|
#
|
||||||
31
src/greg.py
Normal file
31
src/greg.py
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
# fsaf
|
||||||
|
|
||||||
|
#declare each video path to track down captures
|
||||||
|
#specific folders to monitor:
|
||||||
|
# C:\Users\lundg\Videos\Captures
|
||||||
|
# "C:\Users\lundg\Videos\Clip Champ"
|
||||||
|
# "C:\Users\lundg\Videos\Call of Duty Modern Warfare 3 (2023)"
|
||||||
|
# "C:\Users\lundg\Videos\Desktop"
|
||||||
|
# "C:\Users\lundg\Videos\SteelSeries Moments"
|
||||||
|
# "C:\Users\lundg\Videos\Captures"
|
||||||
|
# "C:\Users\lundg\Videos\Fortnite"
|
||||||
|
# "C:\Users\lundg\Videos\RealVNC"
|
||||||
|
|
||||||
|
#essentially any picture of video under C://Users//lundg//Videoo
|
||||||
|
|
||||||
|
# pictures, audio files and video files(and paths) need to be logged for of all files(videos and pictures in this directories) and store them in a list
|
||||||
|
#each file that is tracked with an object should also be logged in a db?
|
||||||
|
|
||||||
|
|
||||||
|
#figure out how to separate audio from video files via an api or cli
|
||||||
|
|
||||||
|
#example extract audio from video.mp4 and save it as audio.mp3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#user can select a audio file and transcribe it with whisper
|
||||||
|
|
||||||
|
#figure out how to design a gui in vscode that can front end this
|
||||||
|
#
|
||||||
@ -17,3 +17,5 @@ def test_audio():
|
|||||||
|
|
||||||
assert np.allclose(mel_from_audio, mel_from_file)
|
assert np.allclose(mel_from_audio, mel_from_file)
|
||||||
assert mel_from_audio.max() - mel_from_audio.min() <= 2.0
|
assert mel_from_audio.max() - mel_from_audio.min() <= 2.0
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user