import openai import gradio as gr import os message=[{"role":"system","content":"You are expert in explaining things in brief way"}] try: openai.api_key = os.environ["apikey"] def ChatReply(Question): message.append({"role":"user","content": Question}) response = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages= message) reply= response["choices"][0]["message"]["content"] message.append({"role":"assistant","content":reply}) return reply except: print("Try Again") custom_theme = gr.themes.Default(primary_hue="blue", secondary_hue="green", neutral_hue="gray") reply = gr.Interface( fn=ChatReply, inputs=gr.Textbox(label="Write any term", placeholder="E.g. Flutter?"), outputs=gr.Textbox(label="Get a simple answer in return:"), theme=custom_theme, title="Explain things in simple way" ) reply.launch()