Spaces:
Sleeping
Sleeping
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() | |