Spaces:
Sleeping
Sleeping
fahadcr14
commited on
Commit
·
1661bec
1
Parent(s):
82ce29b
test
Browse files- .gitignore +0 -0
- Dockerfile +20 -0
- README.md +13 -0
- app.py +23 -0
- requirements.txt +17 -0
- templates/index.html +12 -0
.gitignore
ADDED
File without changes
|
Dockerfile
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use a lightweight Python base image
|
2 |
+
FROM python:3.8-slim
|
3 |
+
|
4 |
+
# Set environment variables
|
5 |
+
ENV PYTHONDONTWRITEBYTECODE=1
|
6 |
+
ENV PYTHONUNBUFFERED=1
|
7 |
+
|
8 |
+
# Install dependencies
|
9 |
+
WORKDIR /app
|
10 |
+
COPY requirements.txt /app/
|
11 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
12 |
+
|
13 |
+
# Copy app files
|
14 |
+
COPY . /app
|
15 |
+
|
16 |
+
# Expose the port Flask will run on
|
17 |
+
EXPOSE 7860
|
18 |
+
|
19 |
+
# Run the Flask app
|
20 |
+
CMD ["python", "app.py"]
|
README.md
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
# mlactions
|
3 |
+
|
4 |
+
---
|
5 |
+
title: {{title}}
|
6 |
+
emoji: {{emoji}}
|
7 |
+
colorFrom: {{colorFrom}}
|
8 |
+
colorTo: {{colorTo}}
|
9 |
+
sdk: {{sdk}}
|
10 |
+
sdk_version: "{{sdkVersion}}"
|
11 |
+
app_file: app.py
|
12 |
+
pinned: false
|
13 |
+
---
|
app.py
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from flask import Flask, request, jsonify, render_template
|
2 |
+
|
3 |
+
app = Flask(__name__)
|
4 |
+
|
5 |
+
# Route for the home page
|
6 |
+
@app.route('/')
|
7 |
+
def index():
|
8 |
+
return render_template('index.html')
|
9 |
+
|
10 |
+
# Prediction endpoint (mock prediction for now)
|
11 |
+
@app.route('/predict', methods=['POST'])
|
12 |
+
def predict():
|
13 |
+
data = request.json
|
14 |
+
activities = data.get('activities')
|
15 |
+
|
16 |
+
# Placeholder logic for prediction (replace with your ML model)
|
17 |
+
if activities:
|
18 |
+
predicted_score = sum(activities) / len(activities) # Example logic
|
19 |
+
return jsonify({'predicted_score': predicted_score})
|
20 |
+
return jsonify({'error': 'No activities provided'}), 400
|
21 |
+
|
22 |
+
if __name__ == '__main__':
|
23 |
+
app.run(host='0.0.0.0', port=7860)
|
requirements.txt
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
certifi==2024.12.14
|
2 |
+
charset-normalizer==3.4.1
|
3 |
+
filelock==3.16.1
|
4 |
+
fsspec==2024.12.0
|
5 |
+
huggingface-hub==0.27.0
|
6 |
+
idna==3.10
|
7 |
+
joblib==1.4.2
|
8 |
+
numpy==2.2.1
|
9 |
+
packaging==24.2
|
10 |
+
PyYAML==6.0.2
|
11 |
+
requests==2.32.3
|
12 |
+
scikit-learn==1.6.0
|
13 |
+
scipy==1.15.0
|
14 |
+
threadpoolctl==3.5.0
|
15 |
+
tqdm==4.67.1
|
16 |
+
typing_extensions==4.12.2
|
17 |
+
urllib3==2.3.0
|
templates/index.html
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>Student Score Predictor</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<h1>Welcome to the Student Score Predictor</h1>
|
10 |
+
<p>Submit your activities scores via POST request to /predict to get the final score prediction.</p>
|
11 |
+
</body>
|
12 |
+
</html>
|