Spaces:
Sleeping
Sleeping
import openai | |
import gradio as gr | |
import os | |
openai.api_key = os.environ["OPENAI_API_KEY"] | |
model_engine = "text-davinci-002" | |
openai.api_key = os.getenv("OPENAI_API_KEY") | |
def chatbot(prompt): | |
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 | |
prompt_text = "Please describe the video you would like to create:" | |
interface = gr.Interface( | |
fn=chatbot, | |
inputs=gr.inputs.Textbox(label=prompt_text, lines=7), | |
outputs=gr.outputs.Textbox(), | |
title="Real Estate Video Script Writer", | |
description="A simple chatbot based on GPT-3 that writes scripts for real estate videos.", | |
) | |
if __name__ == "__main__": | |
interface.launch() | |