Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,7 +27,7 @@ def remove_punctuation(text):
|
|
| 27 |
punctuation_free = "".join([i for i in text if i not in string.punctuation])
|
| 28 |
return punctuation_free
|
| 29 |
|
| 30 |
-
def test_model(text):
|
| 31 |
# Convert text to lowercase
|
| 32 |
text = text.lower()
|
| 33 |
|
|
@@ -54,8 +54,11 @@ def test_model(text):
|
|
| 54 |
# Return the prediction
|
| 55 |
return prediction
|
| 56 |
|
| 57 |
-
#
|
| 58 |
-
|
|
|
|
| 59 |
|
| 60 |
-
#
|
|
|
|
| 61 |
iface.launch()
|
|
|
|
|
|
| 27 |
punctuation_free = "".join([i for i in text if i not in string.punctuation])
|
| 28 |
return punctuation_free
|
| 29 |
|
| 30 |
+
def test_model(text, vectorizer):
|
| 31 |
# Convert text to lowercase
|
| 32 |
text = text.lower()
|
| 33 |
|
|
|
|
| 54 |
# Return the prediction
|
| 55 |
return prediction
|
| 56 |
|
| 57 |
+
# Fit the vectorizer on your training data to build the vocabulary
|
| 58 |
+
train_data = [...] # Replace [...] with your actual training data
|
| 59 |
+
vectorizer.fit(train_data)
|
| 60 |
|
| 61 |
+
# Create the Gradio interface
|
| 62 |
+
iface = gr.Interface(fn=test_model, inputs=["text", vectorizer], outputs="text", title="Text Classification")
|
| 63 |
iface.launch()
|
| 64 |
+
|