Update app.py
Browse files
app.py
CHANGED
@@ -8,17 +8,16 @@ vectorizer = joblib.load('count_vectorizer2.joblib')
|
|
8 |
|
9 |
def predict(input_text):
|
10 |
# Preprocess the input with your vectorizer and encoder as needed
|
11 |
-
# For example, if your model expects vectorized input:
|
12 |
vectorized_text = vectorizer.transform([input_text])
|
13 |
|
14 |
# Make a prediction
|
15 |
prediction = model.predict(vectorized_text)
|
16 |
|
17 |
-
#
|
18 |
decoded_prediction = encoder.inverse_transform(prediction)
|
19 |
|
20 |
-
# Return the prediction
|
21 |
-
return
|
22 |
|
23 |
# Setup the Gradio interface
|
24 |
iface = gr.Interface(fn=predict,
|
@@ -38,4 +37,4 @@ def greet(name):
|
|
38 |
|
39 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
40 |
iface.launch()
|
41 |
-
"""
|
|
|
8 |
|
9 |
def predict(input_text):
|
10 |
# Preprocess the input with your vectorizer and encoder as needed
|
|
|
11 |
vectorized_text = vectorizer.transform([input_text])
|
12 |
|
13 |
# Make a prediction
|
14 |
prediction = model.predict(vectorized_text)
|
15 |
|
16 |
+
# Decode the prediction into a readable label
|
17 |
decoded_prediction = encoder.inverse_transform(prediction)
|
18 |
|
19 |
+
# Return the decoded prediction
|
20 |
+
return decoded_prediction[0] #
|
21 |
|
22 |
# Setup the Gradio interface
|
23 |
iface = gr.Interface(fn=predict,
|
|
|
37 |
|
38 |
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
39 |
iface.launch()
|
40 |
+
"""
|