Create model.py
Browse files
model.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
|
| 3 |
+
# Load the Hugging Face model pipeline (example: text classification)
|
| 4 |
+
def load_model():
|
| 5 |
+
model = pipeline("text-classification")
|
| 6 |
+
return model
|
| 7 |
+
|
| 8 |
+
def predict(model, text):
|
| 9 |
+
# Get the prediction for the input text
|
| 10 |
+
prediction = model(text)
|
| 11 |
+
return prediction
|