Update app.py
Browse files
app.py
CHANGED
|
@@ -129,18 +129,18 @@ def predict(image: Image.Image, text: str) -> str:
|
|
| 129 |
)
|
| 130 |
predicted_class = torch.sigmoid(classification_output).round().item()
|
| 131 |
|
| 132 |
-
return "
|
| 133 |
|
| 134 |
# Gradio Interface
|
| 135 |
interface = gr.Interface(
|
| 136 |
fn=predict,
|
| 137 |
inputs=[
|
| 138 |
-
gr.Image(type="pil", label="Upload Image"),
|
| 139 |
-
gr.Textbox(lines=2, placeholder="Enter text for classification...", label="Input Text")
|
| 140 |
],
|
| 141 |
outputs=gr.Label(label="Prediction"),
|
| 142 |
-
title="
|
| 143 |
-
description="Upload an image and provide
|
| 144 |
)
|
| 145 |
|
| 146 |
interface.launch()
|
|
|
|
| 129 |
)
|
| 130 |
predicted_class = torch.sigmoid(classification_output).round().item()
|
| 131 |
|
| 132 |
+
return "Fake News" if predicted_class == 1 else "Real News"
|
| 133 |
|
| 134 |
# Gradio Interface
|
| 135 |
interface = gr.Interface(
|
| 136 |
fn=predict,
|
| 137 |
inputs=[
|
| 138 |
+
gr.Image(type="pil", label="Upload Related Image"),
|
| 139 |
+
gr.Textbox(lines=2, placeholder="Enter news text for classification...", label="Input Text")
|
| 140 |
],
|
| 141 |
outputs=gr.Label(label="Prediction"),
|
| 142 |
+
title="Fake News Detector",
|
| 143 |
+
description="Upload an image and provide text to classify the news as 'Fake' or 'Real'."
|
| 144 |
)
|
| 145 |
|
| 146 |
interface.launch()
|