Spaces:
Paused
Paused
Commit
·
5d095b2
1
Parent(s):
227e456
Initial Hugging Face Spaces version
Browse files- Dockerfile +4 -4
- backend/app.py → app.py +12 -24
- space.yaml +3 -3
Dockerfile
CHANGED
|
@@ -8,15 +8,15 @@ RUN apt-get update && apt-get install -y \
|
|
| 8 |
# Set working directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
-
# Copy
|
| 12 |
-
COPY .
|
| 13 |
|
| 14 |
# Install Python dependencies
|
| 15 |
RUN pip install --upgrade pip
|
| 16 |
RUN pip install -r requirements.txt
|
| 17 |
|
| 18 |
-
# Expose port
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
-
#
|
| 22 |
CMD ["python", "app.py"]
|
|
|
|
| 8 |
# Set working directory
|
| 9 |
WORKDIR /app
|
| 10 |
|
| 11 |
+
# Copy everything to the container
|
| 12 |
+
COPY . .
|
| 13 |
|
| 14 |
# Install Python dependencies
|
| 15 |
RUN pip install --upgrade pip
|
| 16 |
RUN pip install -r requirements.txt
|
| 17 |
|
| 18 |
+
# Expose port (Flask runs on 7860)
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
+
# Run the app
|
| 22 |
CMD ["python", "app.py"]
|
backend/app.py → app.py
RENAMED
|
@@ -6,54 +6,42 @@ import sys
|
|
| 6 |
import json
|
| 7 |
from datetime import datetime
|
| 8 |
|
| 9 |
-
from backend.routes.interview_api import interview_api
|
| 10 |
-
app.register_blueprint(interview_api, url_prefix="/api")
|
| 11 |
-
|
| 12 |
# Adjust sys.path for import flexibility
|
| 13 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 14 |
parent_dir = os.path.dirname(current_dir)
|
| 15 |
sys.path.append(parent_dir)
|
| 16 |
sys.path.append(current_dir)
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
# Initialize Flask app
|
| 19 |
app = Flask(__name__)
|
| 20 |
app.config['SECRET_KEY'] = 'your-secret-key'
|
| 21 |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///codingo.db'
|
| 22 |
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
from backend.models.database import db, Job, Application, init_db
|
| 26 |
-
|
| 27 |
init_db(app)
|
| 28 |
|
| 29 |
-
# Import models/routes AFTER initializing the DB
|
| 30 |
-
from backend.models.user import User
|
| 31 |
-
from backend.routes.auth import auth_bp
|
| 32 |
-
|
| 33 |
-
# Import other modules
|
| 34 |
-
try:
|
| 35 |
-
from backend.form.JobApplicationForm import JobApplicationForm
|
| 36 |
-
except ImportError:
|
| 37 |
-
from form.JobApplicationForm import JobApplicationForm
|
| 38 |
-
|
| 39 |
-
try:
|
| 40 |
-
from backend.models.resume_parser.resume_to_features import extract_resume_features
|
| 41 |
-
except ImportError:
|
| 42 |
-
from models.resume_parser.resume_to_features import extract_resume_features
|
| 43 |
-
|
| 44 |
# Flask-Login setup
|
| 45 |
login_manager = LoginManager()
|
| 46 |
login_manager.login_view = 'auth.login'
|
| 47 |
login_manager.init_app(app)
|
| 48 |
|
| 49 |
-
|
| 50 |
@login_manager.user_loader
|
| 51 |
def load_user(user_id):
|
| 52 |
return db.session.get(User, int(user_id))
|
| 53 |
|
| 54 |
-
|
| 55 |
-
# Register auth blueprint
|
| 56 |
app.register_blueprint(auth_bp)
|
|
|
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
def handle_resume_upload(file):
|
|
|
|
| 6 |
import json
|
| 7 |
from datetime import datetime
|
| 8 |
|
|
|
|
|
|
|
|
|
|
| 9 |
# Adjust sys.path for import flexibility
|
| 10 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 11 |
parent_dir = os.path.dirname(current_dir)
|
| 12 |
sys.path.append(parent_dir)
|
| 13 |
sys.path.append(current_dir)
|
| 14 |
|
| 15 |
+
# Import and initialize DB
|
| 16 |
+
from backend.models.database import db, Job, Application, init_db
|
| 17 |
+
from backend.models.user import User
|
| 18 |
+
from backend.routes.auth import auth_bp
|
| 19 |
+
from backend.routes.interview_api import interview_api
|
| 20 |
+
from backend.models.resume_parser.resume_to_features import extract_resume_features
|
| 21 |
+
|
| 22 |
+
|
| 23 |
# Initialize Flask app
|
| 24 |
app = Flask(__name__)
|
| 25 |
app.config['SECRET_KEY'] = 'your-secret-key'
|
| 26 |
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///codingo.db'
|
| 27 |
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
| 28 |
|
| 29 |
+
# Initialize DB with app
|
|
|
|
|
|
|
| 30 |
init_db(app)
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
# Flask-Login setup
|
| 33 |
login_manager = LoginManager()
|
| 34 |
login_manager.login_view = 'auth.login'
|
| 35 |
login_manager.init_app(app)
|
| 36 |
|
|
|
|
| 37 |
@login_manager.user_loader
|
| 38 |
def load_user(user_id):
|
| 39 |
return db.session.get(User, int(user_id))
|
| 40 |
|
| 41 |
+
# Register blueprints
|
|
|
|
| 42 |
app.register_blueprint(auth_bp)
|
| 43 |
+
app.register_blueprint(interview_api, url_prefix="/api")
|
| 44 |
+
|
| 45 |
|
| 46 |
|
| 47 |
def handle_resume_upload(file):
|
space.yaml
CHANGED
|
@@ -1,5 +1,5 @@
|
|
| 1 |
-
|
| 2 |
-
title: Codingo - AI Interview System
|
| 3 |
sdk: docker
|
| 4 |
-
|
| 5 |
license: apache-2.0
|
|
|
|
|
|
| 1 |
+
title: Codingo AI Interviewer
|
|
|
|
| 2 |
sdk: docker
|
| 3 |
+
python_version: 3.10
|
| 4 |
license: apache-2.0
|
| 5 |
+
app_file: app.py
|