Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,6 +5,8 @@ from PIL import Image
|
|
| 5 |
import os
|
| 6 |
from huggingface_hub import snapshot_download
|
| 7 |
|
|
|
|
|
|
|
| 8 |
local_model_path = snapshot_download(repo_id="ElBeh/ma_basemodel")
|
| 9 |
model = keras.models.load_model(local_model_path)
|
| 10 |
|
|
@@ -12,7 +14,7 @@ def get_prediction(img):
|
|
| 12 |
x = np.array(img)
|
| 13 |
x = np.expand_dims(x, axis=0)
|
| 14 |
predictions = model.predict(x)
|
| 15 |
-
return predictions
|
| 16 |
|
| 17 |
st.title("Fake Detection")
|
| 18 |
|
|
@@ -23,10 +25,8 @@ if file_name is not None:
|
|
| 23 |
|
| 24 |
image = Image.open(file_name)
|
| 25 |
col1.image(image, use_column_width=True)
|
| 26 |
-
st.subheader('Bild geladen')
|
| 27 |
-
|
| 28 |
predictions = get_prediction(image)
|
| 29 |
|
| 30 |
col2.header("Probabilities")
|
| 31 |
-
for p in predictions:
|
| 32 |
-
col2.subheader(f"{
|
|
|
|
| 5 |
import os
|
| 6 |
from huggingface_hub import snapshot_download
|
| 7 |
|
| 8 |
+
models = ['DDPM','Glide','Latent Diffusion','Palette','Echt','Stable Diffusion','Unseen Fake','VQ Diffusion']
|
| 9 |
+
|
| 10 |
local_model_path = snapshot_download(repo_id="ElBeh/ma_basemodel")
|
| 11 |
model = keras.models.load_model(local_model_path)
|
| 12 |
|
|
|
|
| 14 |
x = np.array(img)
|
| 15 |
x = np.expand_dims(x, axis=0)
|
| 16 |
predictions = model.predict(x)
|
| 17 |
+
return predictions[0,:]
|
| 18 |
|
| 19 |
st.title("Fake Detection")
|
| 20 |
|
|
|
|
| 25 |
|
| 26 |
image = Image.open(file_name)
|
| 27 |
col1.image(image, use_column_width=True)
|
|
|
|
|
|
|
| 28 |
predictions = get_prediction(image)
|
| 29 |
|
| 30 |
col2.header("Probabilities")
|
| 31 |
+
for idx,p in enumerate(predictions):
|
| 32 |
+
col2.subheader(f"{ idx }: { round(p * 100, 12)}%")
|