openai import openai import gradio as gr openai.api_key = "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" messages = [ {"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.."}, ] def chatbot(input): if input: messages.append({"role": "user", "content": input}) chat = openai.ChatCompletion.create( model="gpt-3.5-turbo", messages=messages ) reply = chat.choices[0].message.content messages.append({"role": "assistant", "content": reply}) return reply inputs = gr.components.Textbox(lines=7, label="Chat with AI") outputs = gr.components.Textbox(label="Reply") gr.Interface(fn=chatbot, inputs=inputs, outputs=outputs, title="AI Chatbot", description="Ask anything you want", theme="Default").launch()