mbarnig's picture
Update app.py
c037b23
raw
history blame
546 Bytes
import os
import gradio as gr
import openai
openai_key = os.environ.get('OpenAI')
openai.api_key = openai_key
def create(thema, gedicht):
poem = openai.Completion.create(
model="text-davinci-002",
prompt=thema,
temperature=0.5,
max_tokens=150,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
return poem
myInput = gr.Textbox(label='Thema')
myOutput = gr.Textbox(label='Gedicht')
demo = gr.Interface(
fn=create,
inputs=myInput,
outputs=myOutput
)
demo.launch()