Priyanhsu commited on
Commit
871c9bf
·
1 Parent(s): 70436ba

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -4
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
- # Create the Gradio interface
58
- iface = gr.Interface(fn=test_model, inputs="text", outputs="text")
 
59
 
60
- # Launch the interface
 
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
+