ChatReviewer / app.py
ShiwenNi's picture
Update app.py
d3b3756
raw
history blame
375 Bytes
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()