Spaces:
Sleeping
Sleeping
File size: 480 Bytes
aa2e875 df36d20 fcab49d b0b982e df36d20 aa2e875 fcab49d df36d20 fcab49d df36d20 aa2e875 fcab49d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
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()
|