Spaces:
Sleeping
Sleeping
import openai | |
import gradio as gr | |
import json | |
openai.api_key = "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" | |
def main(user_messages: list): | |
response = openai.ChatCompletion.create( | |
model="gpt-3.5-turbo", | |
messages=user_messages | |
) | |
reply = response["choices"][0]["message"]["content"] | |
return reply | |
iface = gr.Interface(fn=main, inputs="json", outputs="text") | |
iface.launch() | |