Xhaheen commited on
Commit
84c1938
1 Parent(s): 19823d9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +29 -0
app.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import openai
2
+ import numpy as np
3
+
4
+ import gradio as gr
5
+
6
+ openai.api_key = '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'
7
+ engine="code-davinci-002"
8
+
9
+
10
+ def happytt(temperature,max_tokens,text):
11
+
12
+ response = openai.Completion.create(
13
+ engine=engine,
14
+ prompt=text,
15
+ temperature=temperature,
16
+ max_tokens=max_tokens,
17
+ top_p=1,
18
+ frequency_penalty=0,
19
+ presence_penalty=0
20
+ )
21
+
22
+ return response.choices[0].text
23
+
24
+
25
+ iface = gr.Interface( happytt,[ gr.inputs.Slider(0, 1, step=0.1),gr.inputs.Slider(1, 4000, step=1),
26
+ gr.inputs.Textbox(type='str',
27
+ label="input prompt")],
28
+ "text")
29
+ iface.launch(debug=True)