Spaces:
Runtime error
Runtime error
Update app.py
Browse files29 unmodified lines30313233343536373839404142434445464748495051525354555618 unmodified lines757677787980818229 unmodified linesuser_profile["field"] = inforeturn "Awesome! Type 'start' below to begin your interview."# Step 3: Launch chat interface with interview contextdef chat_bot():def respond(message, history):messages = [{"role": "system", "content": f"You are a professional interviewer for a {user_profile['interview_type']} interview in the {user_profile['field']} field."}]if history:messages.extend(history)messages.append({"role": "user", "content": message})response = ""for msg in client.chat_completion(messages,max_tokens=100,stream=True):token = msg.choices[0].delta.contentresponse += tokenyield responsegr.ChatInterface(respond, title="Intervu - AI Interview Practice").launch()# Build UIwith gr.Blocks() as demo:18 unmodified linesbackground_btn.click(save_background, inputs=background, outputs=background_out)gr.Markdown("### Step 3: Start Your Interview")start_btn = gr.Button("Launch Chat Interview")start_btn.click(fn=chat_bot, inputs=[], outputs=[])demo.launch()29 unmodified lines30313233343536373839404142434445464748495051525318 unmodified lines727374757677787929 unmodified linesuser_profile["field"] = inforeturn "Awesome! Type 'start' below to begin your interview."# Step 3: Response logic for embedded Chatbotdef respond(message, history):messages = [{"role": "system", "content": f"You are a professional interviewer for a {user_profile['interview_type']} interview in the {user_profile['field']} field."}]if history:messages.extend(history)messages.append({"role": "user", "content": message})response = ""for msg in client.chat_completion(messages,max_tokens=100,stream=True):token = msg.choices[0].delta.contentresponse += tokenyield response# Build UIwith gr.Blocks() as demo:18 unmodified linesbackground_btn.click(save_background, inputs=background, outputs=background_out)gr.Markdown("### Step 3: Start Your Interview")chatbot = gr.ChatInterface(respond, title="Intervu - AI Interview Practice")demo.launch()
app.py+20-23