Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -77,7 +77,7 @@ import requests
|
|
| 77 |
@st.cache_resource
|
| 78 |
def load_image_model():
|
| 79 |
|
| 80 |
-
url =
|
| 81 |
|
| 82 |
model_path = "image_model.h5"
|
| 83 |
|
|
@@ -109,12 +109,7 @@ def predict_news(text):
|
|
| 109 |
|
| 110 |
return prediction, confidence
|
| 111 |
|
| 112 |
-
# ---------------------------
|
| 113 |
-
with st.spinner("Loading models... โณ Please wait"):
|
| 114 |
-
tokenizer, text_model = load_text_model()
|
| 115 |
-
image_model = load_image_model()
|
| 116 |
|
| 117 |
-
st.success("Models Loaded Successfully โ
")
|
| 118 |
# TABS
|
| 119 |
# ---------------------------
|
| 120 |
tab1, tab2 = st.tabs(["๐ฐ Fake News Detection", "๐ผ๏ธ AI Image Detection"])
|
|
@@ -124,7 +119,8 @@ tab1, tab2 = st.tabs(["๐ฐ Fake News Detection", "๐ผ๏ธ AI Image Detection"])
|
|
| 124 |
# ===========================
|
| 125 |
with tab1:
|
| 126 |
st.subheader("๐ฐ Fake News Detector")
|
| 127 |
-
|
|
|
|
| 128 |
user_input = st.text_area("Paste news article here...")
|
| 129 |
|
| 130 |
if st.button("๐ Analyze News"):
|
|
@@ -145,6 +141,8 @@ with tab1:
|
|
| 145 |
# ===========================
|
| 146 |
with tab2:
|
| 147 |
st.subheader("๐ผ๏ธ AI Image Detector")
|
|
|
|
|
|
|
| 148 |
|
| 149 |
uploaded_file = st.file_uploader("Upload Image", type=["jpg", "png", "jpeg"])
|
| 150 |
|
|
|
|
| 77 |
@st.cache_resource
|
| 78 |
def load_image_model():
|
| 79 |
|
| 80 |
+
url ="https://huggingface.co/syeda-Rija20/image-detector/resolve/main/image_detector_finetuned.h5"
|
| 81 |
|
| 82 |
model_path = "image_model.h5"
|
| 83 |
|
|
|
|
| 109 |
|
| 110 |
return prediction, confidence
|
| 111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
|
|
|
| 113 |
# TABS
|
| 114 |
# ---------------------------
|
| 115 |
tab1, tab2 = st.tabs(["๐ฐ Fake News Detection", "๐ผ๏ธ AI Image Detection"])
|
|
|
|
| 119 |
# ===========================
|
| 120 |
with tab1:
|
| 121 |
st.subheader("๐ฐ Fake News Detector")
|
| 122 |
+
with st.spinner("Loading text model... โณ"):
|
| 123 |
+
tokenizer, text_model = load_text_model()
|
| 124 |
user_input = st.text_area("Paste news article here...")
|
| 125 |
|
| 126 |
if st.button("๐ Analyze News"):
|
|
|
|
| 141 |
# ===========================
|
| 142 |
with tab2:
|
| 143 |
st.subheader("๐ผ๏ธ AI Image Detector")
|
| 144 |
+
with st.spinner("Loading image model... โณ"):
|
| 145 |
+
image_model = load_image_model()
|
| 146 |
|
| 147 |
uploaded_file = st.file_uploader("Upload Image", type=["jpg", "png", "jpeg"])
|
| 148 |
|