Spaces:
Build error
Build error
Upload 4 files
Browse files- .huggingface.yaml +9 -0
- README.md +3 -0
- app.py +16 -0
- requirements.txt +3 -0
.huggingface.yaml
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
title: Propaganda Detector UI
|
| 2 |
+
emoji: 🧠
|
| 3 |
+
colorFrom: indigo
|
| 4 |
+
colorTo: red
|
| 5 |
+
sdk: gradio
|
| 6 |
+
sdk_version: 5.29.1
|
| 7 |
+
app_file: app.py
|
| 8 |
+
pinned: false
|
| 9 |
+
license: mit
|
README.md
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Propaganda Detector UI
|
| 2 |
+
|
| 3 |
+
This Gradio Space detects propaganda-like statements using a fine-tuned DistilBERT model.
|
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
clf = pipeline("text-classification", model="AjayPlus/propaganda-detector-v2")
|
| 5 |
+
|
| 6 |
+
def predict(text):
|
| 7 |
+
return clf(text)
|
| 8 |
+
|
| 9 |
+
with gr.Blocks() as demo:
|
| 10 |
+
with gr.Row():
|
| 11 |
+
input_text = gr.Textbox(label="Enter a sentence")
|
| 12 |
+
output_json = gr.JSON(label="Prediction")
|
| 13 |
+
input_text.submit(predict, input_text, output_json)
|
| 14 |
+
|
| 15 |
+
demo.queue()
|
| 16 |
+
demo.launch(show_api=True)
|
requirements.txt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
transformers
|
| 2 |
+
torch
|
| 3 |
+
gradio==5.29.1
|