Update app.py
Browse files
app.py
CHANGED
@@ -43,9 +43,11 @@ def inference(audio):
|
|
43 |
options = whisper.DecodingOptions(fp16 = False)
|
44 |
# transcribe speech to text
|
45 |
result = whisper.decode(model, mel, options)
|
46 |
-
|
|
|
|
|
47 |
### code
|
48 |
-
input_ids = tokenizer(result.text, return_tensors="pt").input_ids
|
49 |
print("inputs ", input_ids)
|
50 |
# length penalty for gpt2.generate???
|
51 |
generated_outputs = gpt2.generate(input_ids, do_sample=True, num_return_sequences=3, output_scores=True)
|
|
|
43 |
options = whisper.DecodingOptions(fp16 = False)
|
44 |
# transcribe speech to text
|
45 |
result = whisper.decode(model, mel, options)
|
46 |
+
|
47 |
+
# Added prompt two 2 lines below
|
48 |
+
prompt = "The following is a transcript of someone talking, please predict what they will say next. \n"
|
49 |
### code
|
50 |
+
input_ids = tokenizer(prompt, result.text, return_tensors="pt").input_ids
|
51 |
print("inputs ", input_ids)
|
52 |
# length penalty for gpt2.generate???
|
53 |
generated_outputs = gpt2.generate(input_ids, do_sample=True, num_return_sequences=3, output_scores=True)
|