Spaces:
Build error
Build error
File size: 729 Bytes
130dc51 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
import gradio as gr
from joblib import load
# Load the vectorizer and model
vectorizer = load('tfidf_vectorizer.pkl')
model = load('fake_review_detector.pkl')
# Prediction function
def predict_review(review):
# Transform the input text into TF-IDF
review_tfidf = vectorizer.transform([review])
# Make a prediction
prediction = model.predict(review_tfidf)[0]
# Return the result
return "THIS IS NOT FAKE" if prediction == 0 else "THIS IS FAKE"
# Gradio interface
interface = gr.Interface(
fn=predict_review,
inputs="text",
outputs="text",
title="Fake Review Detector",
description="Type a review below to determine if it is fake or not."
)
# Launch the interface
interface.launch()
|