-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding nullable column to postgres images table with type Vector to s… #357
Open
ahmednasserswe
wants to merge
12
commits into
develop
Choose a base branch
from
CV2-3917-sscd-NULLABLE-pg_vector-column-in-Alegre-images-table
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1b189c9
Adding nullable column to postgres images table with type Vector to s…
ahmednasserswe ccb4cb9
moving `CREATE EXTENSION IF NOT EXISTS vector;` under init_perl_funct…
ahmednasserswe ee54b8c
setting pgvector version to pgvector==0.1.8
ahmednasserswe 22a5360
Call presto from image.py to calculate SSCD
ahmednasserswe b74be8c
adding ` elif similarity_type == "image_sscd__Model": return N…
ahmednasserswe 04dd0c8
adding `e = sys.exc_info()[0]` to sscd `expect`
ahmednasserswe 61e5e97
Update `image_similarity.py` to search postgres by sscd cosine sim
ahmednasserswe 538f3b5
Add models parameter to image GET and POST
b217ffc
Passing 'models' params in 'add_image'
ahmednasserswe 4e6798f
adding `create_sscd_column` migration script
ahmednasserswe 6278ab5
passing 'models = models' as paramter 'ImageModel.from_url'
ahmednasserswe 8b59feb
adding 'models = ['phash']' to ' ImageModel.from_url' and ''models': …
ahmednasserswe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
from app.main.lib.language_analyzers import init_indices | ||
from app.main.lib.image_hash import compute_phash_int | ||
from PIL import Image | ||
from sqlalchemy import text | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Imports from package sqlalchemy are not grouped |
||
|
||
# Don't remove this line until https://github.com/tensorflow/tensorflow/issues/34607 is fixed | ||
# (by upgrading to tensorflow 2.2 or higher) | ||
|
@@ -229,6 +230,13 @@ def init_perl_functions(): | |
LANGUAGE plperl; | ||
""") | ||
) | ||
sqlalchemy.event.listen( | ||
db.metadata, | ||
'before_create', | ||
DDL(""" | ||
CREATE EXTENSION IF NOT EXISTS vector; | ||
""") | ||
) | ||
db.create_all() | ||
|
||
@manager.command | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""create sscd column | ||
|
||
Revision ID: 61ac93be86b2 | ||
Revises: e495509fad52 | ||
Create Date: 2023-11-06 20:57:37.335903 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
from pgvector.sqlalchemy import Vector | ||
from app.main import create_app, db | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '61ac93be86b2' | ||
down_revision = 'e495509fad52' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# op.add_column('images', sa.Column('sscd', Vector(256), nullable=True)) | ||
pass | ||
|
||
|
||
def downgrade(): | ||
# op.drop_index(op.f('ix_images_sscd'), table_name='images') | ||
# op.drop_column('images', 'sscd') | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pgvector | ||
openai[embeddings]==0.27.4 | ||
matplotlib==3.5.3 | ||
plotly==5.14.1 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused variable 'sscd'