Skip to content

Instantly share code, notes, and snippets.

@jurand71
Created December 5, 2022 08:51
Show Gist options
  • Save jurand71/f2815cdd132e68174107144a301a1988 to your computer and use it in GitHub Desktop.
Save jurand71/f2815cdd132e68174107144a301a1988 to your computer and use it in GitHub Desktop.
import os
import openai
import ipywidgets as widgets
openai.api_key = "#API Key"
def GPT3_Completion(prompt):
response = openai.Completion.create(
engine = 'text-davinci-003',
prompt = prompt,
temperature = 0.5,
max_tokens = 255,
frequency_penalty = 0,
presence_penalty = 0
)
return print(response.choices[0].text)
# define the person for whom the wishes need to be prepared
to_whom_label = widgets.Label('Do kogo mają być skierowane życzenia?')
display(to_whom_label)
to_whom = widgets.Text(value='przyjaciela', disable=False)
display(to_whom)
# entry text
prompt = f"""
Napisz życzenia świąteczno-noworoczne skierowane do {to_whom.value} w trzech zdaniach,
używając słów zdrowie, szczęście, pogoda ducha, choinka
"""
GPT3_Completion(prompt)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment