Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,8 +46,8 @@ openai.api_key = os.environ["Openai_APIkey"]
|
|
| 46 |
# Transcribe function
|
| 47 |
def transcribe(audio_file):
|
| 48 |
print("Transcribing")
|
| 49 |
-
|
| 50 |
-
transcription = asr_model.transcribe(audio_file)
|
| 51 |
return transcription
|
| 52 |
|
| 53 |
def inference(audio, latest):
|
|
@@ -57,12 +57,12 @@ def inference(audio, latest):
|
|
| 57 |
|
| 58 |
if transcript != None:
|
| 59 |
latest.append(transcript)
|
| 60 |
-
|
| 61 |
-
else:
|
| 62 |
|
| 63 |
response = openai.Completion.create(
|
| 64 |
model="text-davinci-003",
|
| 65 |
-
prompt=
|
| 66 |
temperature=0.8,
|
| 67 |
max_tokens=18,
|
| 68 |
n=5)
|
|
|
|
| 46 |
# Transcribe function
|
| 47 |
def transcribe(audio_file):
|
| 48 |
print("Transcribing")
|
| 49 |
+
transcription = asr_model.transcribe(audio_file)["text"]
|
| 50 |
+
#transcription = asr_model.transcribe(audio_file)
|
| 51 |
return transcription
|
| 52 |
|
| 53 |
def inference(audio, latest):
|
|
|
|
| 57 |
|
| 58 |
if transcript != None:
|
| 59 |
latest.append(transcript)
|
| 60 |
+
tscript = EXAMPLE_PROMPT + str(transcript) + "\nPrediction: "
|
| 61 |
+
else: tscript = EXAMPLE_PROMPT
|
| 62 |
|
| 63 |
response = openai.Completion.create(
|
| 64 |
model="text-davinci-003",
|
| 65 |
+
prompt=tscript,
|
| 66 |
temperature=0.8,
|
| 67 |
max_tokens=18,
|
| 68 |
n=5)
|