Spaces:
Runtime error
Runtime error
Download src/inference.py from viswanani/GullyDRS.LBW.Predictorapp: direct link, hf CLI and curl.
- Browser
- Download file 400 Bytes
-
https://huggingface.co/spaces/viswanani/GullyDRS.LBW.Predictorapp/resolve/main/src/inference.py
- Command line
-
hf download hf://spaces/viswanani/GullyDRS.LBW.Predictorapp/src/inference.py
-
curl -L -o inference.py https://huggingface.co/spaces/viswanani/GullyDRS.LBW.Predictorapp/resolve/main/src/inference.py
400 Bytes
| 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}") | |