HUXTT / .py
LuxOAI's picture
Create .py
0e2e50c
raw
history blame
417 Bytes
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()