ag1 / app.py
abhishekt's picture
api secret added
95541a6
raw
history blame
No virus
654 Bytes
import openai
import gradio
import os
openai.api_key = os.environ["api"]
def generate_product_name(prompt):
model_engine = "text-davinci-003"
prompt = (f"{prompt} \n\n Generated product names: \n\n")
completions = openai.Completion.create(
engine=model_engine,
prompt=prompt,
max_tokens=1024,
n=1,
stop=None,
temperature=0.5,
)
message = completions.choices[0].text.strip()
return message.replace("\n", ", ")
iface = gradio.Interface(
fn=generate_product_name,
inputs="text",
outputs="text",
title="Product Name Generator",
flagging=False
)
iface.launch()