Spaces:
Runtime error
Runtime error
File size: 721 Bytes
fbcd512 ffab655 fbcd512 1f1fd59 fbcd512 58bb04e 1f1fd59 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import config
import openai
openai.api_key = config.api_key
def question(question):
response = openai.Completion.create(
model="code-davinci-002",
prompt="##### Fix bugs in the below function\n \n### Buggy Python\nimport Random\na = random.randint(1,12)\nb = random.randint(1,12)\nfor i in range(10):\n question = \"What is \"+a+\" x \"+b+\"? \"\n answer = input(question)\n if answer = a*b\n print (Well done!)\n else:\n print(\"No.\")\n \n### Fixed Python",
temperature=0,
max_tokens=182,
top_p=1.0,
frequency_penalty=0.0,
presence_penalty=0.0,
stop=["###"]
)
return response.choices[0].text
result = question() |