-
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: save proof prediction for all proofs in a new table (#588)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
a5c0df4
commit cb1fb7a
Showing
12 changed files
with
597 additions
and
102 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,12 +38,17 @@ jobs: | |
echo "SSH_HOST=10.1.0.200" >> $GITHUB_ENV | ||
echo "ENVIRONMENT=net" >> $GITHUB_ENV | ||
echo "CSRF_TRUSTED_ORIGINS=https://prices.openfoodfacts.net" >> $GITHUB_ENV | ||
# Triton server is on the same datacenter as the staging server, so we use the internal IP | ||
echo "TRITON_URI=10.1.0.200:5504" >> $GITHUB_ENV | ||
- name: Set various variable for production deployment | ||
if: matrix.env == 'open-prices-org' | ||
run: | | ||
echo "SSH_HOST=10.1.0.201" >> $GITHUB_ENV | ||
echo "ENVIRONMENT=org" >> $GITHUB_ENV | ||
echo "CSRF_TRUSTED_ORIGINS=https://prices.openfoodfacts.org" >> $GITHUB_ENV | ||
# Triton server is on Moji datacenter, so we use the stunnel client running | ||
# on the OVH datacenter to access it | ||
echo "TRITON_URI=10.1.0.101:5504" >> $GITHUB_ENV | ||
- name: Wait for docker image container build workflow | ||
uses: tomchv/[email protected] | ||
id: wait-build | ||
|
@@ -133,6 +138,7 @@ jobs: | |
echo "ENVIRONMENT=${{ env.ENVIRONMENT }}" >> .env | ||
echo "GOOGLE_CLOUD_VISION_API_KEY=${{ secrets.GOOGLE_CLOUD_VISION_API_KEY }}" >> .env | ||
echo "GOOGLE_GEMINI_API_KEY=${{ secrets.GOOGLE_GEMINI_API_KEY }}" >> .env | ||
echo "TRITON_URI=${{ env.TRITON_URI }}" >> .env | ||
- name: Create Docker volumes | ||
uses: appleboy/ssh-action@master | ||
|
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
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
101 changes: 101 additions & 0 deletions
101
open_prices/proofs/migrations/0006_add_proof_prediction_table.py
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,101 @@ | ||
# Generated by Django 5.1 on 2024-12-01 17:41 | ||
|
||
import django.db.models.deletion | ||
import django.utils.timezone | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("proofs", "0005_proof_receipt_price_count_proof_receipt_price_total"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="ProofPrediction", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"type", | ||
models.CharField( | ||
choices=[ | ||
("OBJECT_DETECTION", "OBJECT_DETECTION"), | ||
("CLASSIFICATION", "CLASSIFICATION"), | ||
("RECEIPT_EXTRACTION", "RECEIPT_EXTRACTION"), | ||
("PRICE_TAG_EXTRACTION", "PRICE_TAG_EXTRACTION"), | ||
], | ||
max_length=20, | ||
verbose_name="The type of the prediction", | ||
), | ||
), | ||
( | ||
"model_name", | ||
models.CharField( | ||
max_length=30, | ||
verbose_name="The name of the model that generated the prediction", | ||
), | ||
), | ||
( | ||
"model_version", | ||
models.CharField( | ||
max_length=30, | ||
verbose_name="The specific version of the model that generated the prediction", | ||
), | ||
), | ||
( | ||
"created", | ||
models.DateTimeField( | ||
default=django.utils.timezone.now, | ||
verbose_name="When the prediction was created in DB", | ||
), | ||
), | ||
( | ||
"data", | ||
models.JSONField( | ||
blank=True, | ||
null=True, | ||
verbose_name="a dict representing the data of the prediction. This field is model-specific.", | ||
), | ||
), | ||
( | ||
"value", | ||
models.CharField( | ||
blank=True, | ||
max_length=30, | ||
null=True, | ||
verbose_name="The predicted value, only for classification models, null otherwise.", | ||
), | ||
), | ||
( | ||
"max_confidence", | ||
models.FloatField( | ||
blank=True, | ||
null=True, | ||
verbose_name="The maximum confidence of the prediction, may be null for some models.For object detection models, this is the confidence of the most confident object.For classification models, this is the confidence of the predicted class.", | ||
), | ||
), | ||
( | ||
"proof", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="predictions", | ||
to="proofs.proof", | ||
verbose_name="The proof this prediction belongs to", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name": "Proof Prediction", | ||
"verbose_name_plural": "Proof Predictions", | ||
"db_table": "proof_predictions", | ||
}, | ||
), | ||
] |
Oops, something went wrong.