Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -46,6 +46,9 @@ model = keras.models.load_model(local_model_path)
|
|
| 46 |
|
| 47 |
st.title("Fake Detection")
|
| 48 |
|
|
|
|
|
|
|
|
|
|
| 49 |
file_name = st.file_uploader("Choose an image...")
|
| 50 |
|
| 51 |
if file_name is not None:
|
|
@@ -54,10 +57,11 @@ if file_name is not None:
|
|
| 54 |
image = ImageOps.exif_transpose(image)
|
| 55 |
|
| 56 |
if image.size != (200, 200) or image.mode != 'RGB':
|
| 57 |
-
|
|
|
|
| 58 |
image = image.resize((200, 200))
|
| 59 |
|
| 60 |
-
if image.format != "JPEG":
|
| 61 |
image = jpg_compression(image)
|
| 62 |
|
| 63 |
col1.image(image, use_column_width=True)
|
|
|
|
| 46 |
|
| 47 |
st.title("Fake Detection")
|
| 48 |
|
| 49 |
+
crop = st.toggle("Activate random crop")
|
| 50 |
+
compress = st.toggle("Activate jpeg compression")
|
| 51 |
+
|
| 52 |
file_name = st.file_uploader("Choose an image...")
|
| 53 |
|
| 54 |
if file_name is not None:
|
|
|
|
| 57 |
image = ImageOps.exif_transpose(image)
|
| 58 |
|
| 59 |
if image.size != (200, 200) or image.mode != 'RGB':
|
| 60 |
+
if crop:
|
| 61 |
+
image = random_crop(image)
|
| 62 |
image = image.resize((200, 200))
|
| 63 |
|
| 64 |
+
if image.format != "JPEG" and compress :
|
| 65 |
image = jpg_compression(image)
|
| 66 |
|
| 67 |
col1.image(image, use_column_width=True)
|