TLeonidas commited on
Commit
8564b32
1 Parent(s): 37c00bb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
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
- # If your model's output needs to be decoded (optional)
18
  decoded_prediction = encoder.inverse_transform(prediction)
19
 
20
- # Return the prediction (you might want to convert it into a more readable form)
21
- return prediction[0] # Modify this according to your needs
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
+ """