Spaces:
Sleeping
Sleeping
Update generate_transcript.py
Browse files- 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 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
)
|
|
|
|
| 95 |
|
| 96 |
-
transcript =
|
| 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 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
|
|
|
|
|
|
|
|
|
| 124 |
)
|
| 125 |
|
| 126 |
-
rewritten_transcript =
|
| 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:
|