Spaces:
Runtime error
Runtime error
Update src/core/inference.py
Browse files- src/core/inference.py +12 -0
src/core/inference.py
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
@st.cache_resource
|
| 5 |
+
def load_deepfake_model():
|
| 6 |
+
"""
|
| 7 |
+
Loads the Hugging Face pipeline for deepfake detection.
|
| 8 |
+
Using `@st.cache_resource` ensures the model is only loaded once per session.
|
| 9 |
+
"""
|
| 10 |
+
model_name = "mangalaparida/dfimgdetection"
|
| 11 |
+
pipe = pipeline("image-classification", model=model_name)
|
| 12 |
+
return pipe
|