Skip to content

Commit

Permalink
[AJP-3] Introduce AI predictions
Browse files Browse the repository at this point in the history
  • Loading branch information
Anna Grund authored and Anna Grund committed Oct 14, 2023
1 parent f5b285f commit 4374b3c
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Generated by Django 3.2.7 on 2023-10-14 14:43

from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

dependencies = [
('ajapaik', '0025_importblacklist'),
]

operations = [
migrations.CreateModel(
name='PhotoModelSuggestionResult',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True, db_index=True)),
('viewpoint_elevation', models.PositiveSmallIntegerField(blank=True, choices=[(0, 'Ground'), (1, 'Raised'), (2, 'Aerial')], null=True, verbose_name='Viewpoint elevation')),
('scene', models.PositiveSmallIntegerField(blank=True, choices=[(0, 'Interior'), (1, 'Exterior')], null=True, verbose_name='Scene')),
('photo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ajapaik.photo')),
],
options={
'abstract': False,
},
),
migrations.CreateModel(
name='PhotoModelSuggestionAlternativeCategory',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('created', models.DateTimeField(auto_now_add=True, db_index=True)),
('viewpoint_elevation_alternation', models.PositiveSmallIntegerField(blank=True, choices=[(0, 'Ground'), (1, 'Raised'), (2, 'Aerial')], null=True, verbose_name='Viewpoint elevation')),
('scene_alternation', models.PositiveSmallIntegerField(blank=True, choices=[(0, 'Interior'), (1, 'Exterior')], null=True, verbose_name='Scene')),
('photo', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ajapaik.photo')),
('proposer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='photo_scene_suggestions_alternation', to='ajapaik.profile')),
],
options={
'db_table': 'ajapaik_photomodelsuggestionalternativecategory',
'unique_together': {('proposer', 'photo_id', 'scene_alternation'), ('proposer', 'photo_id', 'viewpoint_elevation_alternation')},
},
),
]
2 changes: 1 addition & 1 deletion ajapaik/ajapaik/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@
name='django.contrib.sitemaps.views.sitemap'),
url(r'^face-recognition/', include(fr_urls)),
url(r'^object-recognition/', include(or_urls)),
url(r'^object-categorization/', include(oc_urls)) #TODO verify
url(r'^object-categorization/', include(oc_urls))
]

if hasattr(settings, 'GOOGLE_ANALYTICS_KEY') and settings.GOOGLE_ANALYTICS_KEY == 'UA-21689048-1':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ class UncategorizedPhoto:
def __init__(self, image_id, user_id, image_name):
self.image_id = image_id
self.user_id = user_id
self.image_name = image_name
self.image_name = image_name
2 changes: 1 addition & 1 deletion ajapaik/ajapaik_object_categorization/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
name='aggregate_category_data'),
url(r'get-uncategorized-images', views.get_uncategorized_photos,
name='get_uncategorized_images')
]
]
2 changes: 1 addition & 1 deletion ajapaik/ajapaik_object_categorization/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ def aggregate_category_data(request: HttpRequest) -> HttpResponse:

response_data = object_categorization_service.aggregate_category_data()

return response.success(response_data)
return response.success(response_data)
4 changes: 2 additions & 2 deletions ajapaik/settings/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
SECRET_KEY = '!!! paste your own secret key here !!!'

MIDDLEWARE = [
# 'corsheaders.middleware.CorsMiddleware',
'corsheaders.middleware.CorsMiddleware',
'django_hosts.middleware.HostsRequestMiddleware',
'django.middleware.gzip.GZipMiddleware',
'django.middleware.security.SecurityMiddleware',
Expand Down Expand Up @@ -199,7 +199,7 @@
'ajapaik.ajapaik_object_recognition',
'ajapaik.ajapaik_object_categorization',
'django_user_agents',
# 'corsheaders',
'corsheaders',

# Django allauth and related applications.
'allauth',
Expand Down

0 comments on commit 4374b3c

Please sign in to comment.