Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -22,6 +22,7 @@ model = joblib.load('model.bin')
|
|
| 22 |
|
| 23 |
# Initialize the vectorizer
|
| 24 |
vectorizer = CountVectorizer()
|
|
|
|
| 25 |
def remove_punctuation(text):
|
| 26 |
punctuation_free = "".join([i for i in text if i not in string.punctuation])
|
| 27 |
return punctuation_free
|
|
@@ -31,7 +32,7 @@ def test_model(text):
|
|
| 31 |
text = text.lower()
|
| 32 |
|
| 33 |
# Remove punctuation
|
| 34 |
-
text =remove_punctuation(text)
|
| 35 |
|
| 36 |
# Remove numbers
|
| 37 |
text = re.sub(r'\d+', '', text)
|
|
@@ -52,6 +53,7 @@ def test_model(text):
|
|
| 52 |
|
| 53 |
# Return the prediction
|
| 54 |
return prediction
|
|
|
|
| 55 |
# Create the Gradio interface
|
| 56 |
iface = gr.Interface(fn=test_model, inputs="text", outputs="text")
|
| 57 |
|
|
|
|
| 22 |
|
| 23 |
# Initialize the vectorizer
|
| 24 |
vectorizer = CountVectorizer()
|
| 25 |
+
|
| 26 |
def remove_punctuation(text):
|
| 27 |
punctuation_free = "".join([i for i in text if i not in string.punctuation])
|
| 28 |
return punctuation_free
|
|
|
|
| 32 |
text = text.lower()
|
| 33 |
|
| 34 |
# Remove punctuation
|
| 35 |
+
text = remove_punctuation(text)
|
| 36 |
|
| 37 |
# Remove numbers
|
| 38 |
text = re.sub(r'\d+', '', text)
|
|
|
|
| 53 |
|
| 54 |
# Return the prediction
|
| 55 |
return prediction
|
| 56 |
+
|
| 57 |
# Create the Gradio interface
|
| 58 |
iface = gr.Interface(fn=test_model, inputs="text", outputs="text")
|
| 59 |
|