hotelvoicechat / chatbot_ai.py
prasanth345's picture
Rename chat_ai.py to chatbot_ai.py
6e9330c verified
raw
history blame
567 Bytes
import gradio as gr
import openai
openai.api_key = "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"
def chatbot(user_input):
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[{"role": "user", "content": user_input}]
)
return response.choices[0].message['content']
iface = gr.Interface(
chatbot,
gr.Textbox(label="User Input"),
gr.Textbox(label="Chatbot Response")
)
iface.launch()