Spaces:
Sleeping
Sleeping
GVAmaresh
commited on
Commit
·
7ef4b83
1
Parent(s):
1a7861d
dev check working
Browse files
app.py
CHANGED
@@ -10,6 +10,60 @@ def greet_json():
|
|
10 |
|
11 |
#--------------------------------------------------------------------------------------------------------------------
|
12 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
import os
|
14 |
import numpy as np
|
15 |
import tensorflow as tf
|
@@ -32,8 +86,8 @@ class UnifiedDeepfakeDetector:
|
|
32 |
def __init__(self):
|
33 |
self.input_shape = (224, 224, 3)
|
34 |
self.vgg_model = self.build_vgg16_model()
|
35 |
-
self.dense_model = tf.keras.models.load_model('
|
36 |
-
self.cnn_model = tf.keras.models.load_model('
|
37 |
self.melody_machine = pipeline(model="MelodyMachine/Deepfake-audio-detection-V2")
|
38 |
|
39 |
def build_vgg16_model(self):
|
|
|
10 |
|
11 |
#--------------------------------------------------------------------------------------------------------------------
|
12 |
|
13 |
+
import os
|
14 |
+
import gdown
|
15 |
+
|
16 |
+
file_id = "1zhisRgRi2qBFX73VFhzh-Ho93MORQqVa"
|
17 |
+
output_dir = "./downloads"
|
18 |
+
output_file = "file.h5"
|
19 |
+
|
20 |
+
if not os.path.exists(output_dir):
|
21 |
+
os.makedirs(output_dir)
|
22 |
+
|
23 |
+
output_path = os.path.join(output_dir, output_file)
|
24 |
+
|
25 |
+
url = f"https://drive.google.com/uc?id={file_id}"
|
26 |
+
|
27 |
+
try:
|
28 |
+
gdown.download(url, output_path, quiet=False)
|
29 |
+
print(f"File downloaded successfully to: {output_path}")
|
30 |
+
except Exception as e:
|
31 |
+
print(f"Error downloading file: {e}")
|
32 |
+
|
33 |
+
output_file = "file.h5"
|
34 |
+
file_path = os.path.join(output_dir, output_file)
|
35 |
+
|
36 |
+
|
37 |
+
#--------------------------------------------------------------------------------------------------------------------
|
38 |
+
|
39 |
+
file_id = "1wIaycDFGTF3e0PpAHKk-GLnxk4cMehOU"
|
40 |
+
output_dir = "./downloads"
|
41 |
+
output_file = "file2.h5"
|
42 |
+
|
43 |
+
if not os.path.exists(output_dir):
|
44 |
+
os.makedirs(output_dir)
|
45 |
+
|
46 |
+
output_path = os.path.join(output_dir, output_file)
|
47 |
+
|
48 |
+
url = f"https://drive.google.com/uc?id={file_id}"
|
49 |
+
|
50 |
+
try:
|
51 |
+
gdown.download(url, output_path, quiet=False)
|
52 |
+
print(f"File downloaded successfully to: {output_path}")
|
53 |
+
except Exception as e:
|
54 |
+
print(f"Error downloading file: {e}")
|
55 |
+
|
56 |
+
output_file = "file2.h5"
|
57 |
+
file_path = os.path.join(output_dir, output_file)
|
58 |
+
|
59 |
+
|
60 |
+
if os.path.exists(file_path):
|
61 |
+
print(f"The file '{output_file}' exists at '{file_path}'.")
|
62 |
+
else:
|
63 |
+
print(f"The file '{output_file}' does not exist at '{file_path}'.")
|
64 |
+
|
65 |
+
#--------------------------------------------------------------------------------------------------------------------
|
66 |
+
|
67 |
import os
|
68 |
import numpy as np
|
69 |
import tensorflow as tf
|
|
|
86 |
def __init__(self):
|
87 |
self.input_shape = (224, 224, 3)
|
88 |
self.vgg_model = self.build_vgg16_model()
|
89 |
+
self.dense_model = tf.keras.models.load_model('file.h5')
|
90 |
+
self.cnn_model = tf.keras.models.load_model('file2.h5')
|
91 |
self.melody_machine = pipeline(model="MelodyMachine/Deepfake-audio-detection-V2")
|
92 |
|
93 |
def build_vgg16_model(self):
|