Fiacre's picture
Update app.py
cc5a369
raw
history blame
No virus
577 Bytes
import os
os.system("pip install openapi")
import openai
from dotenv import load_dotenv, find_dotenv
_ = load_dotenv(find_dotenv())
import gradio as gr
model="gpt-3.5-turbo"
def get_completion(prompt):
messages = [{"role": "user", "content": prompt}]
response = openai.ChatCompletion.create(
model=model,
messages=messages,
temperature=0, # this is the degree of randomness of the model's output
)
return response.choices[0].message["content"]
iface = gr.Interface(fn=get_completion, inputs="text", outputs="text")
iface.launch()