kvi-detector / app.py
Kvikontent's picture
Update app.py
4b74a37 verified
raw
history blame
615 Bytes
import gradio as gr
from transformers import pipeline
# Load the GPT-2 pipeline for text generation
classifier = pipeline("text-classification", model="gpt2")
def analyze_text(text):
# Use the GPT-2 classifier to predict if the text is fake or true
result = classifier(text)[0]
# Extract the label and confidence score
label = result['label']
score = result['score']
return {"Result": label, "Confidence (%)": score * 100}
# Gradio interface with soft theme
gr.Interface(analyze_text,
"text",
"text",
theme="soft"
).launch()