{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "7daa2ba7", "metadata": {}, "outputs": [], "source": [ "import gradio as gr\n", "from openai import OpenAI\n", "from dotenv import load_dotenv\n", "import os " ] }, { "cell_type": "code", "execution_count": 2, "id": "7de6ebda", "metadata": {}, "outputs": [], "source": [ "\n", "projects = [\n", " {\"image\": \"projects_images/s_up.jpeg\", \"title\": \"Ai Recommendation System\"},\n", " {\"image\": \"projects_images/llm.jpeg\", \"title\": \"LLM Automation\"},\n", " {\"image\": \"projects_images/bi.png\", \"title\": \"BI\"},\n", " {\"image\": \"projects_images/robot.png\", \"title\": \"Robot Arm Control With Ros Python and AI \"},\n", "]\n", " " ] }, { "cell_type": "code", "execution_count": 3, "id": "8e38d667", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "True" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "load_dotenv()\n" ] }, { "cell_type": "code", "execution_count": 4, "id": "7708eac4", "metadata": {}, "outputs": [], "source": [ "with open(\"cv/me.txt\", \"r\") as f: \n", " cv_text = f.read()" ] }, { "cell_type": "code", "execution_count": 5, "id": "34dc7b6a", "metadata": {}, "outputs": [], "source": [ "client = OpenAI()" ] }, { "cell_type": "code", "execution_count": 6, "id": "efd52cc5", "metadata": {}, "outputs": [], "source": [ "system_prompt = f\"\"\"\n", "Your name is Alexander.You are acting as Alexander Todorov. You will answer questions related to your career, skills, work experience, and education. \\\n", "Questions will be asked by visitors, headhunters, or recruiters about potential job opportunities. \\\n", "Respond professionally and use professional language. \\\n", "Answer only questions that are directly related to your CV. If you do not find the answer in your CV, respond with: \\\n", "\"I can only answer questions about my CV.\"\n", "\n", "CV: {cv_text}\n", "With this context, please chat with the user, always staying in character as Alexander Todorov.\n", "\"\"\"\n", "\n" ] }, { "cell_type": "code", "execution_count": 7, "id": "5e16df81", "metadata": {}, "outputs": [], "source": [ "def chat(message,history):\n", " messages = [{\"role\":\"system\", \"content\":system_prompt}] + history + [{\"role\":\"user\", \"content\":message}]\n", " response = client.chat.completions.create(model=\"gpt-4o-mini\", messages=messages)\n", " return response.choices[0].message.content" ] }, { "cell_type": "code", "execution_count": 8, "id": "ad803f77", "metadata": {}, "outputs": [], "source": [ "# --------- CHAT FUNCTION FOR THE AGENT ----------\n", "def chat_with_agent(message, history):\n", " # Call your Agent here (OpenAI Agent, LangChain, etc.)\n", " # For now return example text:\n", " return f\"You said: {message}\"" ] }, { "cell_type": "code", "execution_count": 9, "id": "f4807389", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "* Running on local URL: http://127.0.0.1:7860\n", "* To create a public link, set `share=True` in `launch()`.\n" ] }, { "data": { "text/html": [ "
" ], "text/plain": [ "Software Engineer & Data Scientist
',\n", " # elem_id=\"job-title-light\")\n", "\n", " # LinkedIn icon with link\n", " \n", " \n", "\n", " # ********************************************************************************************************* \n", " \n", " with gr.Row():\n", " with gr.Column(scale=1): # 1 part\n", " gr.Image(\"cv/avatar.jpeg\", \n", " type=\"pil\", \n", " show_label=False, \n", " height=150, \n", " interactive=False, \n", " container=False, \n", " buttons=[['download', 'share', 'fullscreen']])\n", "\n", " # Right column 75% width\n", " with gr.Column(scale=3): # 3 parts\n", " gr.Markdown(\"\"\"\n", "\n", " Software and Data Engineer with over five years of experience delivering intelligent, \n", " user-focused AI solutions and driving automation and innovation in complex environments.\n", "
\n", "Chat with Me About My CV
',\n", " elem_id=\"job-title-light\")\n", " gr.Markdown('Examples of My Work
',\n", " elem_id=\"job-title-light\")\n", " gr.Markdown('