mbarnig commited on
Commit
f40d377
·
1 Parent(s): a2a682e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -3,4 +3,24 @@ import gradio as gr
3
  import openai
4
 
5
  openai_key = os.environ.get('OpenAI')
6
- print(openai_key)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  import openai
4
 
5
  openai_key = os.environ.get('OpenAI')
6
+
7
+ def create(thema, gedicht):
8
+ poem = openai.Completion.create(
9
+ model="text-davinci-002",
10
+ prompt=thema,
11
+ temperature=0.5,
12
+ max_tokens=150,
13
+ top_p=1,
14
+ frequency_penalty=0,
15
+ presence_penalty=0
16
+ )
17
+ return poem
18
+
19
+ myInput = gr.Textbox(label='Thema')
20
+ myOutput = gr.Textbox(label='Gedicht')
21
+
22
+ demo = gr.Interface(
23
+ fn=create,
24
+ inputs=myInput,
25
+ outputs=myOutput
26
+ )