import gradio as gr from openai import OpenAI from dotenv import load_dotenv import os projects = [ {"image": "projects_images/s_up.jpeg", "title": "Ai Recommendation System"}, {"image": "projects_images/llm.jpeg", "title": "LLM Automation"}, {"image": "projects_images/bi.png", "title": "BI"}, {"image": "projects_images/robot.png", "title": "Robot Arm Control With Ros Python and AI "}, ] load_dotenv() client = OpenAI() with open("cv/me.txt", "r") as f: cv_text = f.read() system_prompt = f""" Your name is Alexander.You are acting as Alexander Todorov. You will answer questions related to your career, skills, work experience, and education. \ Questions will be asked by visitors, headhunters, or recruiters about potential job opportunities. \ Respond professionally and use professional language. \ Answer only questions that are directly related to your CV. If you do not find the answer in your CV, respond with: \ "I can only answer questions about my CV." CV: {cv_text} With this context, please chat with the user, always staying in character as Alexander Todorov. """ def chat(message,history): messages = [{"role":"system", "content":system_prompt}] + history + [{"role":"user", "content":message}] response = client.chat.completions.create(model="gpt-4o-mini", messages=messages) return response.choices[0].message.content with gr.Blocks() as ui: # name and job title with gr.Row(): with gr.Column(scale=1): gr.Markdown('
Alexander Todorov
') with gr.Column(scale=4): gr.Markdown(""" LinkedIn """) # gr.Markdown(f'

Software Engineer & Data Scientist

', # elem_id="job-title-light") # LinkedIn icon with link # ********************************************************************************************************* with gr.Row(): with gr.Column(scale=1): # 1 part gr.Image("cv/avatar.jpeg", type="pil", show_label=False, height=150, interactive=False, container=False, buttons=[['download', 'share', 'fullscreen']]) # Right column 75% width with gr.Column(scale=3): # 3 parts gr.Markdown("""

Software and Data Engineer with over five years of experience delivering intelligent, user-focused AI solutions and driving automation and innovation in complex environments.

""") # ****************************************************************************************************************** # Chatbot gr.Markdown(f'

Chat with Me About My CV

', elem_id="job-title-light") gr.Markdown('
', elem_id="custom_divider") chatbot = gr.Chatbot(placeholder="Interactive CV Guide
Ask Me Anything", height=300) chat_interface = gr.ChatInterface(fn=chat, chatbot=chatbot) gr.Markdown('
') # horizontal line # **************************************************************************************************************** # Projects gr.Markdown(f'

Examples of My Work

', elem_id="job-title-light") gr.Markdown('
', elem_id="custom_divider") # Projects row with gr.Row(): for project in projects: with gr.Column(): # equal width for each project # Project image (disable download) gr.Image(project["image"], type="pil", show_label=False, interactive=False, height=200, width=350, buttons=[['download', 'share', 'fullscreen']]) # Project title / text gr.Markdown(f"
{project['title']}
") if __name__ == "__main__": ui.launch()