Spaces:
Running
Running
File size: 546 Bytes
b0129d8 cfd6a01 b0129d8 ec41d97 28ac2d9 f40d377 5e9b63d c037b23 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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() |