Commit 9685721c authored by Artem Baranovskyi's avatar Artem Baranovskyi
Browse files

Moodle and Python services are separated to isolated services.

parent e1145f95
......@@ -66,7 +66,7 @@ function local_asystgrade_before_footer()
$apiendpoint = get_config('local_asystgrade', 'apiendpoint');
if (!$apiendpoint) {
$apiendpoint = 'http://127.0.0.1:5000/api/autograde'; // Default setting
$apiendpoint = 'http://flask:5000/api/autograde'; // Default setting, flask is the name of flask container
}
error_log('APIendpoint: ' . $apiendpoint);
......
File mode changed from 100644 to 100755
FROM python:3.11-slim
# Installing system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
python3-venv \
&& rm -rf /var/lib/apt/lists/*
# Creating and activating the virtual environment \
RUN python3 -m venv /opt/myenv
ENV PATH="/opt/myenv/bin:$PATH"
WORKDIR /app
RUN ls -la /app
COPY . /app
# Installing dependencies
RUN /opt/myenv/bin/pip install --no-cache-dir -i https://pypi.tuna.tsinghua.edu.cn/simple -r /app/requirements.txt
#RUN /opt/myenv/bin/python3 -m pip install -r /app/requirements.txt
RUN /opt/myenv/bin/python3 -m pip install --upgrade setuptools wheel
COPY ./asyst /app/asyst
# Set permissions
RUN chown -R www-data:www-data /app/asyst
RUN chmod -R 755 /app/asyst
# Open port for Flask API
EXPOSE 5000
# Launch application
CMD ["python", "/app/api.py"]
\ No newline at end of file
......@@ -36,7 +36,7 @@ def process_data(data):
parser.add_argument(
"--model_dir",
default="/var/www/html/moodle/asyst/Source/Skript/german/models",
default="/app/asyst/Source/Skript/german/models",
type=str,
required=False,
help="The directory where the ML models are stored.",
......@@ -65,7 +65,7 @@ def process_data(data):
X_test = computed_simis_test
# UP: read pre-trained LR model
clf_log = pickle.load(open("/var/www/html/moodle/asyst/Source/Skript/german/models/clf_BERT.pickle", "rb"))
clf_log = pickle.load(open("/app/asyst/Source/Skript/german/models/clf_BERT.pickle", "rb"))
predictions = clf_log.predict(X_test)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment