Skip to content

Commit d058036

Browse files
Version running on Cardiff University servers (#6)
* committing changes * branch ready * changes * needs translations * ready to merge * updated requirements * changed css * changed requirements.txt * fixed issue with sentiment table * edited gitignore * gitignore change * word freq menu in progress * word use progress * removed unnecessary files * added file inside sentiment plots dir to be tracked * punc menu changes * made punctuation menu responsive for smaller screens * word cloud changes progress * word cloud progress * worc cloud changed working * word cloud changes * changing dark mode * word cloud changes * word cloud bug fix * clean up list next * word cloud finished * word use and relationships dropdown new features started * word use & relationship dropdown changes implemented * changed word use menu padding * functionality added for dropdown for sem tags and pos tags * dropdown changes complete * dropdown changes in progress * dropdown include filtered data checkbox implemented * minor bugfixes * file size limit implemented, currently 1mb * added humanizer for file size check * word use bug fixed: user could repeatedly drag the window range slider, making continuous server requests, now only calls once deselected * bugfix with word use window size range selector * word cloud filtering changed for negative frequency values. Now all selected values will always appear in cloud * minor changes * minor changes * minor change to word_cloud_generator.py * minimal changes * minimal changes * fixed issue where previous word cloud would not clear when new data is selected * added hover effect for word cloud enlarge icon * added word cloud radio language switching * added aspect based sentiment analyser route (absa) * absa frontend implementation started * absa intial implementation * commented out debug line * added function to remove old plots * absa changes and translations added * absa implementation progress * added conditional to remove previous datatables * absa change: added total occurrences to each pie * Files sync * Staging to move to Docker build * minor change, pulling to newfeatures branch * Fixed requirements for a modern-ish python3.10 * Removed unused includes to allow the build to actually run * Actual working docker build for FreeTxt2 :) * Added detail on how to run and build the docker image to the README * Minor debugging in sentiment_analyzer.py and File_analysis.py. Adding small changes from development branch. --------- Co-authored-by: Dr John Vidler <j.vidler@lancaster.ac.uk>
1 parent 1800401 commit d058036

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+23462
-9381
lines changed

.DS_Store

-10 KB
Binary file not shown.

.dockerignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
__pycache__/
2-
Dockerfile
1+
venv
2+
**/__pycache__/
3+
Dockerfile

.github/workflows/publish.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Create and publish a Docker image
2+
3+
on:
4+
push:
5+
6+
# Defines two custom environment variables for the workflow.
7+
# These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
# There is a single job in this workflow.
13+
# It's configured to run on the latest available version of Ubuntu.
14+
jobs:
15+
build-and-push-image:
16+
runs-on: ubuntu-latest
17+
18+
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
19+
permissions:
20+
contents: read
21+
packages: write
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v3
26+
27+
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and
28+
# password that will publish the packages. Once published, the packages are scoped to the account defined here.
29+
- name: Log in to the Container registry
30+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
31+
with:
32+
registry: ${{ env.REGISTRY }}
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and
37+
# labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be
38+
# referenced in a subsequent step. The `images` value provides the base name for the tags and labels.
39+
- name: Extract metadata (tags, labels) for Docker
40+
id: meta
41+
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
42+
with:
43+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
45+
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`.
46+
# If the build succeeds, it pushes the image to GitHub Packages.
47+
# It uses the `context` parameter to define the build's context as the set of files located in the specified path.
48+
# For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the
49+
# `docker/build-push-action` repository.
50+
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
51+
- name: Build and push Docker image
52+
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
53+
with:
54+
context: .
55+
push: true
56+
tags: ${{ steps.meta.outputs.tags }}
57+
labels: ${{ steps.meta.outputs.labels }}

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
venv/
22
en_core_web_sm-3.2.0/
33
huggingface_cache/
4+
**/__pycache__
5+
website/Uploaded/*
6+
!website/Uploaded/Reviews_Lexham_Gardens_London.xlsx

Dockerfile

+22-7
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,27 @@
1-
FROM python:3
2-
3-
COPY . /opt/FreeTxt
4-
WORKDIR /opt/FreeTxt
1+
FROM python:3.10-bookworm
52

63
ENV FLASK_APP=main.py
4+
ENV PATH="/home/user/.local/bin:$PATH"
5+
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
RUN apt-get update && apt-get install -y python3-dev libevent-dev build-essential software-properties-common libpangocairo-1.0-0
8+
9+
RUN useradd -m user && \
10+
chown -R user:user /home/user && \
11+
mkdir -p /cache && \
12+
mkdir -p /var/freetxt && \
13+
chown -R user:user /cache && \
14+
chown -R user:user /var/freetxt
15+
USER user
16+
17+
COPY --chown=user:user requirements.txt /freetxt/requirements.txt
18+
WORKDIR /freetxt
719

820
RUN pip install --upgrade pip && \
9-
pip install -r requirements.txt
21+
pip install --no-cache-dir -r requirements.txt && \
22+
python3 -m nltk.downloader all
23+
24+
COPY --chown=user:user . /freetxt
1025

11-
CMD [ "flask", "run" ]
12-
EXPOSE 5000
26+
CMD [ "python3", "main.py" ]
27+
EXPOSE 8000

0 commit comments

Comments
 (0)