Redmind commited on
Commit
0bef3a8
·
verified ·
1 Parent(s): a5bca4d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -3
app.py CHANGED
@@ -27,9 +27,35 @@ def whisper_openai_transcribe(audio_file):
27
  return transcribed_text
28
 
29
  def deepgram_transcribe(audio_file):
30
- # Replace with actual Deepgram API transcription code
31
- transcription = "This is a dummy transcription from Deepgram API"
32
- return transcription
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
 
34
  def assemblyai_transcribe(audio_file):
35
  import assemblyai as aai
 
27
  return transcribed_text
28
 
29
  def deepgram_transcribe(audio_file):
30
+ from deepgram import DeepgramClient, PrerecordedOptions
31
+
32
+ DEEPGRAM_API_KEY = "aeb38b43a17867c59928e6a103ac75c06d4e896d"
33
+
34
+ #AUDIO_URL = {
35
+ "#url": "https://static.deepgram.com/examples/Bueller-Life-moves-pretty-fast.wav"
36
+ #}
37
+
38
+ try:
39
+ deepgram = DeepgramClient(DEEPGRAM_API_KEY)
40
+
41
+ options = PrerecordedOptions(
42
+ model="enhanced",
43
+ language="ta",
44
+ smart_format=True,
45
+ punctuate=True,
46
+ paragraphs=True,
47
+ utterances=True,
48
+ keywords=[":"],
49
+ diarize=True,
50
+ )
51
+
52
+ response = deepgram.listen.prerecorded.v("1").transcribe_url(audio_file, options)
53
+ print(response.to_json(indent=4))
54
+
55
+ except Exception as e:
56
+ print(f"Exception: {e}")
57
+
58
+ return response
59
 
60
  def assemblyai_transcribe(audio_file):
61
  import assemblyai as aai