yasserrmd commited on
Commit
5e82a0a
1 Parent(s): 66742ae

Update generate_transcript.py

Browse files
Files changed (1) hide show
  1. generate_transcript.py +21 -10
generate_transcript.py CHANGED
@@ -7,6 +7,8 @@ import pickle
7
  from tqdm import tqdm
8
  import warnings
9
  import spaces
 
 
10
 
11
  warnings.filterwarnings('ignore')
12
 
@@ -87,13 +89,19 @@ class TranscriptProcessor:
87
  {"role": "user", "content": input_text}
88
  ]
89
 
90
- output = self.model(
91
- messages,
92
- max_new_tokens=8126,
93
- temperature=1
 
 
 
 
 
94
  )
 
95
 
96
- transcript = output[0]["generated_text"]
97
 
98
  # Save the transcript as a pickle file
99
  with open(self.transcript_output_path, 'wb') as f:
@@ -117,13 +125,16 @@ class TranscriptProcessor:
117
  {"role": "user", "content": input_transcript}
118
  ]
119
 
120
- output = self.model(
121
- messages,
122
- max_new_tokens=8126,
123
- temperature=1
 
 
 
124
  )
125
 
126
- rewritten_transcript = output[0]["generated_text"]
127
 
128
  # Save the rewritten transcript as a pickle file
129
  with open(self.tts_output_path, 'wb') as f:
 
7
  from tqdm import tqdm
8
  import warnings
9
  import spaces
10
+ from groq import Groq
11
+ import os
12
 
13
  warnings.filterwarnings('ignore')
14
 
 
89
  {"role": "user", "content": input_text}
90
  ]
91
 
92
+
93
+
94
+ client = Groq(
95
+ api_key=os.environ.get("GROQ_API_KEY"),
96
+ )
97
+
98
+ chat_completion = client.chat.completions.create(
99
+ messages=messages,
100
+ model=self.model_name,
101
  )
102
+
103
 
104
+ transcript = chat_completion.choices[0].message.content
105
 
106
  # Save the transcript as a pickle file
107
  with open(self.transcript_output_path, 'wb') as f:
 
125
  {"role": "user", "content": input_transcript}
126
  ]
127
 
128
+ client = Groq(
129
+ api_key=os.environ.get("GROQ_API_KEY"),
130
+ )
131
+
132
+ chat_completion = client.chat.completions.create(
133
+ messages=messages,
134
+ model=self.model_name,
135
  )
136
 
137
+ rewritten_transcript = chat_completion.choices[0].message.content
138
 
139
  # Save the rewritten transcript as a pickle file
140
  with open(self.tts_output_path, 'wb') as f: