mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Transcribe cog
This commit is contained in:
@@ -1,35 +0,0 @@
|
||||
# Start by making sure the `assemblyai` package is installed.
|
||||
# If not, you can install it by running the following command:
|
||||
# pip install -U assemblyai
|
||||
#
|
||||
# Note: Some macOS users may need to use `pip3` instead of `pip`.
|
||||
|
||||
import assemblyai as aai
|
||||
from discord.ext import commands
|
||||
# Replace with your API key
|
||||
aai.settings.api_key = "aa9962f0088a449a9c4ab2361e96cc08"
|
||||
|
||||
# URL of the file to transcribe
|
||||
FILE_URL = "https://github.com/AssemblyAI-Community/audio-examples/raw/main/20230607_me_canadian_wildfires.mp3"
|
||||
|
||||
# You can also transcribe a local file by passing in a file path
|
||||
# FILE_URL = './path/to/file.mp3'
|
||||
|
||||
config = aai.TranscriptionConfig(speaker_labels=True)
|
||||
|
||||
transcriber = aai.Transcriber()
|
||||
transcript = transcriber.transcribe(
|
||||
FILE_URL,
|
||||
config=config
|
||||
)
|
||||
|
||||
for utterance in transcript.utterances:
|
||||
print(f"Speaker {utterance.speaker}: {utterance.text}")
|
||||
|
||||
|
||||
|
||||
|
||||
class Transcriber(commands.Cog):
|
||||
def __init__(self,bot):
|
||||
self.bot = bot
|
||||
self._last_member = None
|
||||
Reference in New Issue
Block a user