Untitled
unknown
plain_text
3 years ago
1.0 kB
10
Indexable
import os
import openai
from flask import Flask, redirect, render_template, request, url_for
openai.api_key = os.getenv("OPENAI_API_KEY")
def affirmative_team_opening_prompt(transcript):
return """Can you evaluate and grade my debate opening for an affirmative statement on "Should schools ban junk food"?
Statement: {} """.format(transcript.text)
affirmativeTeamOpeningRecordPath = "C:/Users/marvi/OneDrive/Área de Trabalho/Projects/Dbtee/records/affirmative-team-opening.m4a"
'''
Calling the API to translate the record to text.
'''
audio_file = open(affirmativeTeamOpeningRecordPath, "rb")
affirmativeStatementTranscript = openai.Audio.transcribe(
"whisper-1", audio_file)
print(affirmativeStatementTranscript)
'''
Calling OpenAI API to evaluate our opening statement:
'''
response = openai.Completion.create(
model="text-davinci-003",
prompt=affirmative_team_opening_prompt(affirmativeStatementTranscript),
temperature=0.6,
max_tokens=4000
)
print(response.choices[0].text)Editor is loading...