import gradio as gr import os import openai os.system('pip install openai') openai.api_key = os.getenv("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") def generate(firstmessage): completion = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=[ {"role": "user", "content": firstmessage} ] ) return completion.choices[0].message iface = gr.Interface(fn=generate, inputs="text", outputs="text") iface.launch()