Spaces:
Running
Running
File size: 375 Bytes
a64d886 cd35ac5 a64d886 363a1de a64d886 d3b3756 a64d886 1298116 e45ad39 a64d886 06f4c1d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
import os
import gradio as gr
import openai
def gpt(api_key):
openai.api_key = api_key
completion = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": "Generate a fake news story"}]
)
return completion.choices[0].message.content
demo = gr.Interface(fn=gpt, inputs="text", outputs="text")
demo.launch() |