Add inference script
Browse files- test_pipeline.py +11 -0
test_pipeline.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from transformers import pipeline
|
| 2 |
+
|
| 3 |
+
def main():
|
| 4 |
+
# Load a sentiment-analysis pipeline (downloads default model)
|
| 5 |
+
sentiment = pipeline("sentiment-analysis")
|
| 6 |
+
# Run inference
|
| 7 |
+
result = sentiment("I love using Hugging Face!")
|
| 8 |
+
print(result)
|
| 9 |
+
|
| 10 |
+
if __name__ == "__main__":
|
| 11 |
+
main()
|