Skip to content

HistoricEngland/arches-image

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

arches-image

THIS ARCHES APP IS CURRENTLY UNDER DEVELOPMENT AS A PROOF OF CONCEPT.
arches-image has not undergone full regression testing for use in production environments. If you choose to use this app, you do so at your own risk.
Please note, this code repository may be changed or removed in future without warning.

An Arches application which contains extensions relating to the use of AI services for analysing images uploaded to an Arches instance. Designed for easy integration with Arches projects.

Requirements

  • Python 3.10+ (Check the Arches python requirements and match your Python version)
  • Arches == 7.6.24

Contents Overview

This Arches application contains the following extensions:

Datatypes and Widgets

  • arches_image/datatypes/extended_file_list.py: Enables tags stored against this datatype to be indexed for search.
  • arches_image/media/js/viewmodels/file-widget-extended.js, arches_image/media/js/views/components/widgets/file-extended.js and arches_image/templates/views/components/widgets/file-extended.htm: Provide the extended file widget UI for displaying and editing AI-generated tags and alt text.

Functions

  • arches_image/templates/views/components/functions/image-alttext-tag-generation.htm, arches_image/media/js/views/components/functions/image-alttext-tag-generation.js and arches_image/functions/image_alttext_tag_generation.py: Implement function configuration UI and server-side logic for generating image tags and alt text using configured AI services.

AI Backends

The AI backend layer is implemented in arches_image/ai_backends/ai_backend_base.py, arches_image/ai_backends/ai_backend_provider_registry.py and provider-specific modules such as arches_image/ai_backends/ai_backend_azurefoundry.py.

Installing for Development

For development purposes, you can treat this app as a standard Arches project. Either use the instructions for developing an Arches project or use the arches-containers configuration included in this repository.

  • For development (standard):

    pip install -e '/path/to/arches_image[dev]'

    This installs the app in editable mode, allowing you to make changes and see them reflected immediately without needing to reinstall.

  • For development using included arches-container configuration:

    Please ensure that you clone the arches-he-sysref-funcs repository into a directory that uses underscores instead of hyphens, as the arches-containers configuration expects this format. For example, clone it to arches_image.

    git clone https://github.com/HistoricEngland/arches-image.git arches_image

    This repository includes an arches-containers project configuration, so you can import, activate, and start the system as follows:

    1. Ensure Docker is installed and running.

    2. Navigate to your workspace directory (the root where your projects and containers live).

    3. Import the arches-container project configuration:

      act import -p arches_image
    4. Activate the project:

      act activate -p arches_image
    5. Start the system:

      act up
    6. Once setup and webpack builds are complete, open a browser and navigate to http://localhost:8002 or use act view in a termainal to open the project in your default browser.

    For more details, see the arches-containers documentation.

Using This App in Your Arches Project

Follow these steps to add arches-image to your Arches project:

1. Add to your_project/pyproject.toml

Add the following to your pyproject.toml dependencies (in the [project] section):

arches-image @ git+https://github.com/HistoricEngland/arches-image.git@release/1.0.0

Example:

dependencies = [
    "arches==7.6.24",
    "arches-image @ git+https://github.com/HistoricEngland/arches-image.git@release/1.0.0",
]

2. Update your_project/your_project/settings.py

Add the following to the appropriate locations:

DATATYPE_LOCATIONS.append("arches_image.datatypes")
FUNCTION_LOCATIONS.append("arches_image.functions")

Add to INSTALLED_APPS and ARCHES_APPLICATIONS:

INSTALLED_APPS = (
    ...
    "your_project",
    "arches_image",
)
ARCHES_APPLICATIONS = ("arches_image",)

3. Update your_project/your_project/urls.py

Include the app's URLs (add project URLs before this):

urlpatterns = [
    # ... your project urls ...
    path("", include("arches_image.urls")),
]

4. Run Database Migrations

Run the following command to apply any database migrations required by this app:

if using the arches-containers, run this in the application container

python manage.py migrate

5. Install and Build Front-End Dependencies

From the directory containing your your_project/package.json:

if using arches-containers, run this in the application container or restart the webpack

npm install
npm run build_development

6. Start Your Arches Project

python manage.py runserver

License

This project is licensed under the GNU AGPLv3. See the LICENSE file for details.


For more information on deploying your Arches project, see the Arches Deployment Guide.

About

A proof of concept for using AI services to enhance image functionality in an Arches project

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors