Spaces:
Runtime error
Runtime error
| from transformers import pipeline | |
| import csv | |
| clf = pipeline("sentiment-analysis", model="./outputs") | |
| def log_inference(text, prediction): | |
| with open("inference_log.csv", "a") as f: | |
| writer = csv.writer(f) | |
| writer.writerow([text, prediction]) | |
| text = "This is a fantastic HuggingFace project!" | |
| result = clf(text)[0] | |
| log_inference(text, result["label"]) | |
| print(f"{text} => {result}") | |