Spaces:
Sleeping
Sleeping
Nathan Slaughter
commited on
Commit
•
bec6d62
1
Parent(s):
c87e011
use json output
Browse files
app.py
CHANGED
@@ -21,6 +21,7 @@ stt_model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
|
21 |
stt_model.to(device)
|
22 |
|
23 |
def transcribe_audio(audio_path: str):
|
|
|
24 |
try:
|
25 |
audio, sr = librosa.load(audio_path, sr=16000)
|
26 |
inputs = stt_processor(audio, sampling_rate=16000, return_tensors="pt", language='en')
|
@@ -50,7 +51,12 @@ def extract_action_items(transcript: str) -> str:
|
|
50 |
|
51 |
messages = [
|
52 |
{"role": "system", "content": "You are the perfect action item extraction system."},
|
53 |
-
{"role": "user", "content": "Extract the action items from the voice note transcript using the following format:\n\n
|
|
|
|
|
|
|
|
|
|
|
54 |
{"role": "user", "content": f"transcript: {transcript}"}
|
55 |
]
|
56 |
text = tokenizer.apply_chat_template(
|
|
|
21 |
stt_model.to(device)
|
22 |
|
23 |
def transcribe_audio(audio_path: str):
|
24 |
+
transcript = ""
|
25 |
try:
|
26 |
audio, sr = librosa.load(audio_path, sr=16000)
|
27 |
inputs = stt_processor(audio, sampling_rate=16000, return_tensors="pt", language='en')
|
|
|
51 |
|
52 |
messages = [
|
53 |
{"role": "system", "content": "You are the perfect action item extraction system."},
|
54 |
+
{"role": "user", "content": """Extract the action items from the voice note transcript using the following format:\n\n
|
55 |
+
[
|
56 |
+
{"title 1": "description 1"},
|
57 |
+
"title 2": "description 2"},
|
58 |
+
...
|
59 |
+
]"""},
|
60 |
{"role": "user", "content": f"transcript: {transcript}"}
|
61 |
]
|
62 |
text = tokenizer.apply_chat_template(
|