File size: 643 Bytes
ef570d8
 
 
5670da9
 
ef570d8
 
 
5670da9
 
ef570d8
 
 
 
 
 
5670da9
ef570d8
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
import joblib

# Load the pipeline (which includes both the vectorizer and the classifier)
pipeline = joblib.load('gibberish_detector_pipeline.joblib')

# Prediction function
def predict(text):
    prediction = pipeline.predict([text])[0]
    return "Gibberish" if prediction == 1 else "Good English"

# Create a Gradio interface
iface = gr.Interface(fn=predict, 
                     inputs="text", 
                     outputs="text", 
                     title="Gibberish Detector", 
                     description="Enter a string to check if it's gibberish or good English.")

# Launch the interface
iface.launch()