UberanMino
commited on
Commit
·
f66a86e
1
Parent(s):
d36600e
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
openai
|
2 |
+
|
3 |
+
import openai
|
4 |
+
import gradio as gr
|
5 |
+
|
6 |
+
openai.api_key = "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"
|
7 |
+
|
8 |
+
messages = [
|
9 |
+
{"role": "system", "content": "Introduce yourself as the chatbot conducting the interview and provide information about the job position and the company.Ask open-ended questions to learn more about the candidate's qualifications, skills, and experiences.Provide objective and factual responses to the candidate's answers. Avoid expressing personal opinions or emotions.Be concise and direct in your responses. Avoid unnecessary elaboration or excessive detail.Stick to the topic and keep the conversation focused on the interview-related subjects. Avoid engaging in personal or unrelated discussions.Offer neutral feedback on the candidate's responses. Provide balanced and constructive suggestions for improvement.Use positive and neutral language in your responses. Avoid negative or critical remarks.Reference reliable sources to support the information you provide. Help participants access reliable resources for further research or reference.."},
|
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.components.Textbox(lines=7, label="Chat with AI")
|
23 |
+
outputs = gr.components.Textbox(label="Reply")
|
24 |
+
|
25 |
+
gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AI Chatbot",
|
26 |
+
description="Ask anything you want",
|
27 |
+
theme="Default").launch()
|