Ruzzel Mendoza commited on
Commit
bfdc38e
·
1 Parent(s): a0fc0ed

integrate database scan to upload plagiarism api

Browse files
Files changed (2) hide show
  1. api/plagiarism.py +3 -0
  2. lib/db_service.py +2 -1
api/plagiarism.py CHANGED
@@ -42,6 +42,7 @@ async def plagiarism_pipeline(file: UploadFile = File(...)):
42
 
43
  # STEP 2 Database scan
44
  artworks = get_all_artwork_hashes()
 
45
  db_match = scan_database(upload_hashes, artworks)
46
 
47
  # STEP 3 Upload to cloudinary
@@ -110,6 +111,8 @@ async def plagiarism_pipeline(file: UploadFile = File(...)):
110
  "filename": file.filename,
111
  "success": True,
112
  "original_hash": upload_hashes["transforms"]["0"]["phash"],
 
 
113
  "best_match": best_match,
114
  "hashes": upload_hashes,
115
  }
 
42
 
43
  # STEP 2 Database scan
44
  artworks = get_all_artwork_hashes()
45
+ print(artworks)
46
  db_match = scan_database(upload_hashes, artworks)
47
 
48
  # STEP 3 Upload to cloudinary
 
111
  "filename": file.filename,
112
  "success": True,
113
  "original_hash": upload_hashes["transforms"]["0"]["phash"],
114
+ "db": db_best,
115
+ "web": web_best,
116
  "best_match": best_match,
117
  "hashes": upload_hashes,
118
  }
lib/db_service.py CHANGED
@@ -33,7 +33,8 @@ def get_all_artwork_hashes():
33
 
34
  artworks.append({
35
  "id": row["id"],
36
- "perceptual_hash": hashes
 
37
  })
38
 
39
  except Exception as e:
 
33
 
34
  artworks.append({
35
  "id": row["id"],
36
+ "perceptual_hash": hashes,
37
+ "c_secure_url": row["c_secure_url"]
38
  })
39
 
40
  except Exception as e: