Spaces:
Runtime error
Runtime error
File size: 731 Bytes
02c04cf dfc10d1 02c04cf dfc10d1 c3223e2 dfc10d1 02c04cf c3223e2 dfc10d1 c3223e2 dfc10d1 c3223e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import os
import openai
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.Model.list()
import gradio as gr
from openai.api_resources import engines
openai.api_key = "OPENAI_API_KEY"
model_engine = "gpt-3.5-turbo"
def chatbot(prompt):
completions = openai.Completion.create(
engine=model_engine,
prompt=prompt,
max_tokens=100,
n=1,
stop=None,
temperature=0.5,
)
response = completions.choices[0].text.strip()
return response
iface = gr.Interface(
fn=chatbot,
inputs=gr.inputs.Textbox(lines=5, placeholder="Enter your message here..."),
outputs="text",
title="Chatbot",
description="A chatbot using OpenAI's GPT-3.5-turbo",
)
iface.launch()
|