Spaces:
Runtime error
Runtime error
Commit ·
28fe720
1
Parent(s): 5392ff4
new
Browse files123456789101112131415161718192021import openai_secret_managerimport openai# Let's setup the API keyassert "openai" in openai_secret_manager.get_services()secrets = openai_secret_manager.get_secrets("openai")# Add the API key to the openai clientopenai.api_key = secrets["api_key"]# Defining the user input texttext = input("Enter your text: ")# Defining the promptprompt = text + " What is the meaning of life?"# Generating the responseresponse = openai.Completion.create(engine="text-davinci-002", prompt=prompt, max_tokens=2048, n=1,stop=None,temperature=0.5)# Printing the responseprint(response["choices"][0]["text"])123import gradio as grgr.Interface.load("models/openai-gpt").launch()
app.py+2-20