lodhrangpt commited on
Commit
85eb5ef
·
verified ·
1 Parent(s): f3f5ab6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -7
app.py CHANGED
@@ -9,19 +9,13 @@ import os
9
  # Ensure nltk resources are downloaded
10
  nltk.download("punkt")
11
 
12
- # Function to send audio to Groq API and get transcription
13
  def transcribe(audio_path):
14
- # Read audio file in binary mode
15
- with open(audio_path, "rb") as audio_file:
16
- audio_data = audio_file.read()
17
-
18
- def transcribe(audio_path):
19
  with open(audio_path, "rb") as audio_file:
20
  audio_data = audio_file.read()
21
 
22
  groq_api_endpoint = "https://api.groq.com/openai/v1/audio/transcriptions"
23
  headers = {
24
- "Authorization": "Bearer YOUR_GROQ_API_KEY", # Replace with your actual API key
25
  }
26
  files = {'file': ('audio.wav', audio_data, 'audio/wav')}
27
  data = {
@@ -40,6 +34,7 @@ def transcribe(audio_path):
40
  return f"API Error: {error_msg}"
41
 
42
 
 
43
  # Function to generate notes and questions
44
  def generate_notes(transcript):
45
  # Split transcript into sentences
 
9
  # Ensure nltk resources are downloaded
10
  nltk.download("punkt")
11
 
 
12
  def transcribe(audio_path):
 
 
 
 
 
13
  with open(audio_path, "rb") as audio_file:
14
  audio_data = audio_file.read()
15
 
16
  groq_api_endpoint = "https://api.groq.com/openai/v1/audio/transcriptions"
17
  headers = {
18
+ "Authorization": "Bearer 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", # Replace with your actual API key
19
  }
20
  files = {'file': ('audio.wav', audio_data, 'audio/wav')}
21
  data = {
 
34
  return f"API Error: {error_msg}"
35
 
36
 
37
+
38
  # Function to generate notes and questions
39
  def generate_notes(transcript):
40
  # Split transcript into sentences