Spaces:
Runtime error
Runtime error
Download utils/file_handler.py from Prashanthsrn/ai_generation_bot: direct link, hf CLI and curl.
- Browser
- Download file 258 Bytes
-
https://huggingface.co/spaces/Prashanthsrn/ai_generation_bot/resolve/main/utils/file_handler.py
- Command line
-
hf download hf://spaces/Prashanthsrn/ai_generation_bot/utils/file_handler.py
-
curl -L -o file_handler.py https://huggingface.co/spaces/Prashanthsrn/ai_generation_bot/resolve/main/utils/file_handler.py
258 Bytes
| import os | |
| import tempfile | |
| def save_uploaded_file(uploaded_file): | |
| with tempfile.NamedTemporaryFile(delete=False, suffix=os.path.splitext(uploaded_file.name)[1]) as temp_file: | |
| temp_file.write(uploaded_file.getvalue()) | |
| return temp_file.name |