diff --git a/.env b/.env new file mode 100644 index 0000000000000000000000000000000000000000..0cff7486498cec9857c67044cb3d0f31b7c02141 --- /dev/null +++ b/.env @@ -0,0 +1,2 @@ +GEMINI_API_KEY=AIzaSyAkFsaN3BKoSQmRW4FzTahhZXbq-ldsDZ4 +GEMINI_MODEL_NAME=gemini-2.5-flash \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000000000000000000000000000000000000..3b664107303df336bab8010caad42ddaed24550e --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "git.ignoreLimitWarning": true +} \ No newline at end of file diff --git a/Data/database/__pycache__/sql_connector.cpython-311.pyc b/Data/database/__pycache__/sql_connector.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2b46d6a3772df76a9096a6c53d99d562797d4a0e Binary files /dev/null and b/Data/database/__pycache__/sql_connector.cpython-311.pyc differ diff --git a/Data/database/__pycache__/sql_connector.cpython-313.pyc b/Data/database/__pycache__/sql_connector.cpython-313.pyc new file mode 100644 index 0000000000000000000000000000000000000000..2a65d9fecae3e6c78008ced81b43d6a1fd82a882 Binary files /dev/null and b/Data/database/__pycache__/sql_connector.cpython-313.pyc differ diff --git a/Data/database/sql_connector.py b/Data/database/sql_connector.py new file mode 100644 index 0000000000000000000000000000000000000000..7c9fc5631b0fce62ed662503ba40f56e8a3d5506 --- /dev/null +++ b/Data/database/sql_connector.py @@ -0,0 +1,60 @@ +from sqlalchemy import create_engine +import pandas as pd +import urllib +import json + +SERVER = "innotrack-sql-server.database.windows.net" +DATABASE = "InnoTrackDB" +USERNAME = "innotrackadmin" +PASSWORD = "Innotrack@admin233" + +params = urllib.parse.quote_plus( + f"DRIVER={{ODBC Driver 18 for SQL Server}};" + f"SERVER={SERVER};" + f"DATABASE={DATABASE};" + f"UID={USERNAME};" + f"PWD={PASSWORD};" + "Encrypt=yes;" + "TrustServerCertificate=no;" + "Connection Timeout=30;" +) + +connection_string = ( + f"mssql+pyodbc:///?odbc_connect={params}" +) + +engine = create_engine(connection_string) + +try: + + with engine.connect() as conn: + print("SQL Connected Successfully") + +except Exception as e: + print("Connection Failed") + print(e) + + + + + +def load_preprocessed_projects(): + + query = """ + SELECT * + FROM PreProcessed_Projects + """ + + df = pd.read_sql( + query, + engine + ) + + if "features" in df.columns: + + df["features"] = ( + df["features"] + .apply(json.loads) + ) + + return df \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..52f4dc5e4bda41fe02ee9b9bf6fd45218ad56209 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM python:3.11-slim + +RUN useradd -m -u 1000 user + +USER user + +ENV HOME=/home/user \ + PATH=/home/user/.local/bin:$PATH \ + PYTHONUNBUFFERED=1 + +WORKDIR $HOME/app + +COPY --chown=user requirements.txt requirements.txt + +RUN pip install --no-cache-dir --upgrade pip && \ + pip install --no-cache-dir -r requirements.txt + +COPY --chown=user . . + +CMD ["uvicorn", "api.main:app", "--host", "0.0.0.0", "--port", "7860"] \ No newline at end of file diff --git a/Notebooks/TEST.ipynb b/Notebooks/TEST.ipynb new file mode 100644 index 0000000000000000000000000000000000000000..f2b31d1027f40bd4363422d461e90a96978e133b --- /dev/null +++ b/Notebooks/TEST.ipynb @@ -0,0 +1,5276 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 35 + }, + "executionInfo": { + "elapsed": 49, + "status": "ok", + "timestamp": 1777121871809, + "user": { + "displayName": "yossef assem", + "userId": "00346058032754430335" + }, + "user_tz": -180 + }, + "id": "C89EBjEsx9Gq", + "outputId": "e76f8c9c-cdcf-4fc7-94b5-4e8a30009518" + }, + "outputs": [ + { + "data": { + "text/plain": [ + "'e:\\\\gradution project'" + ] + }, + "execution_count": 20, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "\n", + "import os\n", + "os.getcwd()\n", + "os.chdir(\"/gradution project\")\n", + "os.getcwd()" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "executionInfo": { + "elapsed": 11569, + "status": "ok", + "timestamp": 1777121884875, + "user": { + "displayName": "yossef assem", + "userId": "00346058032754430335" + }, + "user_tz": -180 + }, + "id": "Eel6SUFWvNMW", + "outputId": "10ac3316-9b05-44f4-81b8-4ba3ff26cc99" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "All modules imported successfully\n" + ] + } + ], + "source": [ + "import pandas as pd\n", + "import numpy as np\n", + "from tqdm.notebook import tqdm\n", + "\n", + "from src.similarity_model import preprocess_dataset\n", + "from src.similarity_model import train_embedding_engine\n", + "from src.similarity_model import search_by_text\n", + "from src.similarity_model import find_similar_projects\n", + "\n", + "print(\"All modules imported successfully\")" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/", + "height": 712 + }, + "executionInfo": { + "elapsed": 93, + "status": "ok", + "timestamp": 1777121887495, + "user": { + "displayName": "yossef assem", + "userId": "00346058032754430335" + }, + "user_tz": -180 + }, + "id": "QlD5ukNTDS6S", + "outputId": "43dab901-85ac-4386-d77a-2bb24af4b111" + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Rows: 301\n" + ] + }, + { + "data": { + "text/html": [ + "
| \n", + " | ID | \n", + "Submitted At | \n", + "Title | \n", + "Student Names | \n", + "Supervisor | \n", + "Year | \n", + "Category | \n", + "Technologies | \n", + "Keywords | \n", + "Abstract | \n", + "Description | \n", + "Problem Statement | \n", + "Proposed Solution | \n", + "Objectives | \n", + "ai summary | \n", + "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 296 | \n", + "OCR_36 | \n", + "NaT | \n", + "Find Missing people using Face Recognition | \n", + "NaN | \n", + "Dr. Mai Kamal | \n", + "2023 | \n", + "surveillance | \n", + "kotlin, python flask | \n", + "artificial intelligence, machine learning, dee... | \n", + "Our project \"Find Missed People Using Face Rec... | \n", + "The problem of missing persons and children is... | \n", + "• The absence of a dedicated digital system fo... | \n", + "Our project \"Find Missed People Using Face Rec... | \n", + "• Develop a user-friendly application accessib... | \n", + "This graduation project, titled \"Find Missing ... | \n", + "
| 297 | \n", + "OCR_37 | \n", + "NaT | \n", + "Remember Me Early diagnosis of Alzheimer's dis... | \n", + "NaN | \n", + "Dr. Mostafa Elgendy | \n", + "2023 | \n", + "medical | \n", + "dart, flutter, HTML, css, js, php, mvc approac... | \n", + "healthcare, medical diagnosis, patient care, m... | \n", + "According to the WHO, around 50 million people... | \n", + "In this project, we aimed to collect all the t... | \n", + "• The absence of a dedicated digital system fo... | \n", + "According to the WHO, around 50 million people... | \n", + "• Develop a user-friendly application accessib... | \n", + "This graduation project, titled \"Remember Me E... | \n", + "
| 298 | \n", + "OCR_40 | \n", + "NaT | \n", + "Mobile Based System for Traffic Monitoring and... | \n", + "NaN | \n", + "Dr. Sahr fawzy | \n", + "2012 | \n", + "General | \n", + "Android | \n", + "general, software system, graduation project, ... | \n", + "The theme of the system/application is the usa... | \n", + "No one can ignore the fact that traffic proble... | \n", + "• The absence of a dedicated digital system fo... | \n", + "The theme of the system/application is the usa... | \n", + "• Develop a user-friendly application accessib... | \n", + "This graduation project, titled \"Mobile Based ... | \n", + "
| 299 | \n", + "OCR_41 | \n", + "NaT | \n", + "Detecting Diseases Using Chatbot and Booking C... | \n", + "NaN | \n", + "Dr. Shadia Sarhan | \n", + "2024 | \n", + "medical | \n", + "php, laravel, mysql, mvc, livewire package, ui... | \n", + "healthcare, medical diagnosis, patient care, m... | \n", + "A Project aim to create application that conta... | \n", + "Many pcople find difficult to search for docto... | \n", + "• The absence of a dedicated digital system fo... | \n", + "A Project aim to create application that conta... | \n", + "• Develop a user-friendly application accessib... | \n", + "This graduation project, titled \"Detecting Dis... | \n", + "
| 300 | \n", + "OCR_46 | \n", + "NaT | \n", + "Electronic School | \n", + "NaN | \n", + "Dr. Shaker Elsabagh | \n", + "2022 | \n", + "Education | \n", + "html, css, JavaScript, jquery, bootstrap, api | \n", + "e-learning, education platform, student manage... | \n", + "Human history is observing a very strange time... | \n", + "The world we live in has been through a lot of... | \n", + "• The absence of a dedicated digital system fo... | \n", + "Human history is observing a very strange time... | \n", + "• Achieve accurate and reliable detection/diag... | \n", + "This graduation project, titled \"Electronic Sc... | \n", + "
| \n", + " | id | \n", + "submitted_at | \n", + "title | \n", + "student_names | \n", + "supervisor | \n", + "year | \n", + "category | \n", + "technologies | \n", + "keywords | \n", + "abstract | \n", + "description | \n", + "problem_statement | \n", + "proposed_solution | \n", + "objectives | \n", + "ai_summary | \n", + "project_title | \n", + "full_content | \n", + "clean_text | \n", + "word_count | \n", + "features | \n", + "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 289 | \n", + "OCR_36 | \n", + "NaT | \n", + "Find Missing people using Face Recognition | \n", + "NaN | \n", + "Dr. Mai Kamal | \n", + "2023 | \n", + "surveillance | \n", + "kotlin, python flask | \n", + "artificial intelligence, machine learning, dee... | \n", + "Our project \"Find Missed People Using Face Rec... | \n", + "The problem of missing persons and children is... | \n", + "• The absence of a dedicated digital system fo... | \n", + "Our project \"Find Missed People Using Face Rec... | \n", + "• Develop a user-friendly application accessib... | \n", + "This graduation project, titled \"Find Missing ... | \n", + "\n", + " | . . Our project \"Find Missed People Using Face... | \n", + ". . our project find missed people using face ... | \n", + "451 | \n", + "[missing person face, facial recognition techn... | \n", + "
| 290 | \n", + "OCR_37 | \n", + "NaT | \n", + "Remember Me Early diagnosis of Alzheimer's dis... | \n", + "NaN | \n", + "Dr. Mostafa Elgendy | \n", + "2023 | \n", + "medical | \n", + "dart, flutter, HTML, css, js, php, mvc approac... | \n", + "healthcare, medical diagnosis, patient care, m... | \n", + "According to the WHO, around 50 million people... | \n", + "In this project, we aimed to collect all the t... | \n", + "• The absence of a dedicated digital system fo... | \n", + "According to the WHO, around 50 million people... | \n", + "• Develop a user-friendly application accessib... | \n", + "This graduation project, titled \"Remember Me E... | \n", + "\n", + " | . . According to the WHO, around 50 million pe... | \n", + ". . according to the who around 50 million peo... | \n", + "478 | \n", + "[alzheimer disease ad, delay alzheimer symptom... | \n", + "
| 291 | \n", + "OCR_40 | \n", + "NaT | \n", + "Mobile Based System for Traffic Monitoring and... | \n", + "NaN | \n", + "Dr. Sahr fawzy | \n", + "2012 | \n", + "General | \n", + "Android | \n", + "general, software system, graduation project, ... | \n", + "The theme of the system/application is the usa... | \n", + "No one can ignore the fact that traffic proble... | \n", + "• The absence of a dedicated digital system fo... | \n", + "The theme of the system/application is the usa... | \n", + "• Develop a user-friendly application accessib... | \n", + "This graduation project, titled \"Mobile Based ... | \n", + "\n", + " | . . The theme of the system/application is the... | \n", + ". . the theme of the system/application is the... | \n", + "369 | \n", + "[location based alternatives, roads provides u... | \n", + "
| 292 | \n", + "OCR_41 | \n", + "NaT | \n", + "Detecting Diseases Using Chatbot and Booking C... | \n", + "NaN | \n", + "Dr. Shadia Sarhan | \n", + "2024 | \n", + "medical | \n", + "php, laravel, mysql, mvc, livewire package, ui... | \n", + "healthcare, medical diagnosis, patient care, m... | \n", + "A Project aim to create application that conta... | \n", + "Many pcople find difficult to search for docto... | \n", + "• The absence of a dedicated digital system fo... | \n", + "A Project aim to create application that conta... | \n", + "• Develop a user-friendly application accessib... | \n", + "This graduation project, titled \"Detecting Dis... | \n", + "\n", + " | . . A Project aim to create application that c... | \n", + ". . a project aim to create application that c... | \n", + "310 | \n", + "[doctors users chatbot, disease symptom paragr... | \n", + "
| 293 | \n", + "OCR_46 | \n", + "NaT | \n", + "Electronic School | \n", + "NaN | \n", + "Dr. Shaker Elsabagh | \n", + "2022 | \n", + "Education | \n", + "html, css, JavaScript, jquery, bootstrap, api | \n", + "e-learning, education platform, student manage... | \n", + "Human history is observing a very strange time... | \n", + "The world we live in has been through a lot of... | \n", + "• The absence of a dedicated digital system fo... | \n", + "Human history is observing a very strange time... | \n", + "• Achieve accurate and reliable detection/diag... | \n", + "This graduation project, titled \"Electronic Sc... | \n", + "\n", + " | . . Human history is observing a very strange ... | \n", + ". . human history is observing a very strange ... | \n", + "511 | \n", + "[learning electronic school, online learning p... | \n", + "
| \n", + " | project_id | \n", + "project_title | \n", + "semantic_score | \n", + "feature_score | \n", + "coverage | \n", + "hybrid_score | \n", + "originality_score | \n", + "confidence_score | \n", + "duplicate_risk | \n", + "shared_features_count | \n", + "matched_features | \n", + "unique_query_features | \n", + "unique_candidate_features | \n", + "query_features_used | \n", + "query_clean_text | \n", + "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", + "202 | \n", + "\n", + " | 0.6151 | \n", + "0.5655 | \n", + "0.1 | \n", + "0.6027 | \n", + "0.4978 | \n", + "0.4922 | \n", + "Medium | \n", + "1 | \n", + "[{'feature_a': 'chatbot book recommendation', ... | \n", + "[library chatbot book, app library chatbot, li... | \n", + "[library systems egypt, collaborative reading ... | \n", + "[library chatbot book, app library chatbot, li... | \n", + "smart library app. smart library app. library ... | \n", + "
| 1 | \n", + "1 | \n", + "\n", + " | 0.4137 | \n", + "0.6019 | \n", + "0.1 | \n", + "0.4846 | \n", + "0.5923 | \n", + "0.4262 | \n", + "Low | \n", + "1 | \n", + "[{'feature_a': 'library chatbot', 'feature_b':... | \n", + "[library chatbot book, app library chatbot, ch... | \n", + "[doctors users chatbot, help patients nearest,... | \n", + "[library chatbot book, app library chatbot, li... | \n", + "smart library app. smart library app. library ... | \n", + "
| 2 | \n", + "225 | \n", + "\n", + " | 0.4159 | \n", + "0.5088 | \n", + "0.1 | \n", + "0.4534 | \n", + "0.6173 | \n", + "0.3899 | \n", + "Low | \n", + "1 | \n", + "[{'feature_a': 'library chatbot', 'feature_b':... | \n", + "[library chatbot book, app library chatbot, ch... | \n", + "[websites features ai, tourists visiting egypt... | \n", + "[library chatbot book, app library chatbot, li... | \n", + "smart library app. smart library app. library ... | \n", + "
| 3 | \n", + "29 | \n", + "\n", + " | 0.3846 | \n", + "0.5648 | \n", + "0.1 | \n", + "0.4527 | \n", + "0.6178 | \n", + "0.3998 | \n", + "Low | \n", + "1 | \n", + "[{'feature_a': 'library chatbot', 'feature_b':... | \n", + "[library chatbot book, app library chatbot, ch... | \n", + "[reading managing computer, books intuitive in... | \n", + "[library chatbot book, app library chatbot, li... | \n", + "smart library app. smart library app. library ... | \n", + "
| 4 | \n", + "183 | \n", + "\n", + " | 0.3346 | \n", + "0.6019 | \n", + "0.1 | \n", + "0.4332 | \n", + "0.6334 | \n", + "0.3946 | \n", + "Low | \n", + "1 | \n", + "[{'feature_a': 'library chatbot', 'feature_b':... | \n", + "[library chatbot book, app library chatbot, ch... | \n", + "[islam mirath calculator, islamic inheritance ... | \n", + "[library chatbot book, app library chatbot, li... | \n", + "smart library app. smart library app. library ... | \n", + "