Codex_OpenAI / app.py
Xhaheen's picture
Upload app.py
c7da8c9
raw
history blame
703 Bytes
import openai
import numpy as np
import os
import gradio as gr
openai.api_key = os.environ["api_key"]
engine = os.environ["engine"]
def happytt(temperature,max_tokens,text):
response = openai.Completion.create(
engine=engine,
prompt=text,
temperature=temperature,
max_tokens=max_tokens,
top_p=1,
frequency_penalty=0,
presence_penalty=0
)
return response.choices[0].text
iface = gr.Interface( happytt,[ gr.inputs.Slider(0, 1, step=0.1),gr.inputs.Slider(1, 4000, step=1),
gr.inputs.Textbox(type='str',
label="input prompt")],
"text")
iface.launch(debug=True)