Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -28,6 +28,7 @@ import warnings
|
|
28 |
warnings.filterwarnings("ignore")
|
29 |
nltk.download('punkt')
|
30 |
nltk.download('stopwords')
|
|
|
31 |
import pickle
|
32 |
model = pickle.load(open("https://huggingface.co/spaces/sercetexam9/fakenewsdetection/resolve/main/fakenews.sav", 'rb'))
|
33 |
import gradio as gr
|
@@ -93,15 +94,16 @@ def predict(text):
|
|
93 |
del pred,logi,out,logits_tensor
|
94 |
gc.collect()
|
95 |
|
96 |
-
|
97 |
if y_pred==[1]:
|
98 |
predict="This may be a fake news."
|
99 |
else:
|
100 |
predict="This may be a real news."
|
101 |
-
return
|
|
|
102 |
demo = gr.Interface(
|
103 |
fn=predict,
|
104 |
inputs=["text"],
|
105 |
-
outputs=["
|
106 |
)
|
107 |
demo.launch(share=True)
|
|
|
28 |
warnings.filterwarnings("ignore")
|
29 |
nltk.download('punkt')
|
30 |
nltk.download('stopwords')
|
31 |
+
from fastapi import FastAPI, Request
|
32 |
import pickle
|
33 |
model = pickle.load(open("https://huggingface.co/spaces/sercetexam9/fakenewsdetection/resolve/main/fakenews.sav", 'rb'))
|
34 |
import gradio as gr
|
|
|
94 |
del pred,logi,out,logits_tensor
|
95 |
gc.collect()
|
96 |
|
97 |
+
result=str()
|
98 |
if y_pred==[1]:
|
99 |
predict="This may be a fake news."
|
100 |
else:
|
101 |
predict="This may be a real news."
|
102 |
+
return result
|
103 |
+
|
104 |
demo = gr.Interface(
|
105 |
fn=predict,
|
106 |
inputs=["text"],
|
107 |
+
outputs=["text"],
|
108 |
)
|
109 |
demo.launch(share=True)
|