Spaces:
Sleeping
Sleeping
File size: 615 Bytes
8e9c493 4b74a37 8e9c493 4b74a37 8e9c493 4b74a37 8e9c493 4b74a37 8e9c493 4b74a37 8e9c493 4b74a37 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
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()
|