Spaces:
Sleeping
Sleeping
Upload 2 files
Browse filesFiles changed (2)
- №1 — app.pyAdded+54
- №2 — requirements.txtAdded+2
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354import osimport gradio as grfrom openai import OpenAI
# Подключение к OpenRouterclient = OpenAI( base_url="https://openrouter.ai/api/v1", api_key=os.getenv("OPENROUTER_API_KEY"))
SYSTEM_PROMPT = """You are a professional job interview simulator.You act as an HR interviewer.
Rules:- Ask one question at a time.- Wait for the user's answer.- After 5 questions, provide structured feedback: - Strengths - Weaknesses - Final recommendationBe realistic and professional."""
def chat_with_ai(message, history): messages = [{"role": "system", "content": SYSTEM_PROMPT}] for human, assistant in history: messages.append({"role": "user", "content": human}) messages.append({"role": "assistant", "content": assistant})
messages.append({"role": "user", "content": message})
response = client.chat.completions.create( model="anthropic/claude-3.5-sonnet", messages=messages, temperature=0.7 )
reply = response.choices[0].message.content return reply
with gr.Blocks() as demo: gr.Markdown("# 🎯 InterviewSim AI") gr.Markdown("Simulate a real job interview and receive feedback.")
chatbot = gr.ChatInterface( chat_with_ai, textbox=gr.Textbox(placeholder="Type your answer here...", container=False), title="AI Interviewer" )
if __name__ == "__main__": demo.launch()12gradioopenai№1 — app.pyAdded+54
№2 — requirements.txtAdded+2