Noobian's picture
Update app.py
ee45ce7
raw
history blame contribute delete
No virus
697 Bytes
import gradio as gr
import openai
import os
openai.api_key = os.environ["OPENAI_KEY"]
def answer_question(question):
response = openai.Completion.create(
engine="text-davinci-002",
prompt="Make a step by step how to based on the prompt: " + question,
max_tokens=1024,
n=1,
stop=None,
temperature=0.7,
).get("choices")[0].text
return response
iface = gr.Interface(answer_question,
gr.inputs.Textbox(lines=5, default="How do i use GPT3?"),
gr.outputs.Textbox(),
title="How to generator",
description="Make how tos from any prompt.")
iface.launch()