Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions backend/server.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import os
import sys
from flask import Flask, request, jsonify
import uuid
import cv2

import importlib.util
import sys
from pathlib import Path

module_path = Path(__file__).resolve().parent.parent / 'AI' / 'main.py'
Expand All @@ -26,12 +23,14 @@
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
app.config['ALLOWED_EXTENSIONS'] = ['jpg', 'png', 'jpeg']

cod_counter = 1
def check_filename(filename):
return '.' in filename and filename.rsplit('.', 1)[1].lower() in app.config['ALLOWED_EXTENSIONS']


@app.route('/upload', methods=['POST'])
def upload_file():
global cod_counter
# verific daca in cerere exista un fisier.
if 'file' not in request.files:
return jsonify({'error': 'No file part'}), 400
Expand All @@ -43,14 +42,14 @@ def upload_file():
return jsonify({'error': 'No selected file'}), 400

if file and check_filename(file.filename):
cod_unic = uuid.uuid4().hex
# am creat un hash unic pe care sa il apenduiesc in fata numelui fisierului, pentru
# ca daca il lasam fara, fisierele nu mai aveau denumiri distincte, si folderul
# ramanea mereu doar cu o poza, la fiecare incarcare a camerei din flutter.
filename = f"{cod_unic}{file.filename}"
filename = f"{cod_counter}_{file.filename}"
# concatenez cu un contor pentru ca altfel, imi punea pozele
# distincte ca acelasi obiect file in folder.
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
cod_counter += 1
return jsonify({'message': 'File uploaded successfully!'}), 200
else:
return jsonify({'error': 'File type not allowed'}), 400
Expand Down
17 changes: 8 additions & 9 deletions sign_language_translator/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@ android {
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
// Actualizează la Java 20 sau Java 21
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
// Configurare Kotlin pentru Java 20
jvmTarget = "20"
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
// Setează applicationId și configurațiile SDK
applicationId = "com.example.sign_language_translator"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
Expand All @@ -32,13 +32,12 @@ android {

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
// TODO: Adaugă propria ta configurare de semnătura pentru build-ul de release
signingConfig = signingConfigs.debug
}
}
}

flutter {
source = "../.."
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
16 changes: 8 additions & 8 deletions sign_language_translator/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ packages:
dependency: transitive
description:
name: camera_android_camerax
sha256: e3627fdc2132d89212b8a8676679f5b07008c7e3d8ae00cea775c3397f9e742b
sha256: "2985b8e5fca62709ebb2150962b1dae0444ba0a112be888ccf21e8371a1406d9"
url: "https://pub.dev"
source: hosted
version: "0.6.10"
version: "0.6.10+1"
camera_avfoundation:
dependency: transitive
description:
Expand Down Expand Up @@ -122,10 +122,10 @@ packages:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
sha256: "5398f14efa795ffb7a33e9b6a08798b26a180edac4ad7db3f231e40f82ce11e1"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "5.0.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
Expand Down Expand Up @@ -188,10 +188,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
sha256: "3315600f3fb3b135be672bf4a178c55f274bebe368325ae18462c89ac1e3b413"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "5.0.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -313,10 +313,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
version: "14.2.4"
version: "14.2.5"
web:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion sign_language_translator/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^4.0.0
flutter_lints: ^5.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
Loading