Add application file
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import openai
|
2 |
+
import gradio as gr
|
3 |
+
import random
|
4 |
+
import time
|
5 |
+
|
6 |
+
openai.api_key = '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'
|
7 |
+
|
8 |
+
messages = [
|
9 |
+
{"role": "system", "content": "You are helpful AI specialized in Oracle Recruiting Cloud.Your name is ORABOT. Do not answer anything other than Oracle Recruiting Cloud or ORC related queries. Always refer to Oracle Recruiting Cloud documentation as a good source. From time to time tell a joke about Oracle."},
|
10 |
+
]
|
11 |
+
|
12 |
+
def chatbot(input):
|
13 |
+
if input:
|
14 |
+
messages.append({"role": "user", "content": input})
|
15 |
+
chat = openai.ChatCompletion.create(
|
16 |
+
model="gpt-3.5-turbo", messages=messages
|
17 |
+
)
|
18 |
+
reply = chat.choices[0].message.content
|
19 |
+
messages.append({"role": "assistant", "content": reply})
|
20 |
+
return reply
|
21 |
+
|
22 |
+
inputs = gr.inputs.Textbox(lines=7, label="Chat with ORABOT")
|
23 |
+
outputs = gr.outputs.Textbox(label="Reply")
|
24 |
+
|
25 |
+
gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="Oracle Recruiting Cloud Expert ChatBot",
|
26 |
+
description="Ask anything on Oracle Recruiting Cloud",
|
27 |
+
theme="panel",).launch(share=True)
|