mskov's picture
Update app.py
546a5e2
raw
history blame
951 Bytes
'''
This script calls the ada model from openai api to predict the next few words.
'''
import os
import openai
PROMPT = """The following is a transcript of a conversation. Predict a few nouns, verbs, or adjectives that may be used next. Predict the next few words as a list of options.
A few examples are provided below and then the current transcript is provided.
Examples:
Transcript: I'm making spaghetti for dinner
Next: Tonight, Tomorrow, for us, our neighbors
Transcript: I would like to order a cheeseburger with a side of
Next: Fries, Milkshake, Apples
Current Transcript:
Transcript: I'm going to the store to buy
Next:"""
openai.api_key = os.environ["Openai_APIkey"]
response = openai.Completion.create(
model="text-ada-001",
prompt=PROMPT,
temperature=1,
max_tokens=4,
n=4)
for i in range(4):
print(response['choices'][i]['text'])