From ab04d1d8943557e41191241686c10d5aa89bddd3 Mon Sep 17 00:00:00 2001 From: hlohaus <983577+hlohaus@users.noreply.github.com> Date: Sun, 26 Jan 2025 02:48:43 +0100 Subject: Increase max token in HuggingfaceAPI Restore browser instance on start up errors in nodriver Restored instances can be used as usual or to stop the browser Add demo modus to web ui for HuggingSpace Add rate limit support to web ui. Simply install flask_limiter Add home for demo with Access Token input and validation Add stripped model list for demo Add ignores for encoding error in web_search and file upload --- g4f/tools/files.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'g4f/tools/files.py') diff --git a/g4f/tools/files.py b/g4f/tools/files.py index d1d45e13..f23f931b 100644 --- a/g4f/tools/files.py +++ b/g4f/tools/files.py @@ -225,9 +225,9 @@ def cache_stream(stream: Iterator[str], bucket_dir: Path) -> Iterator[str]: for chunk in read_path_chunked(cache_file): yield chunk return - with open(tmp_file, "w") as f: + with open(tmp_file, "wb") as f: for chunk in stream: - f.write(chunk) + f.write(chunk.encode(errors="replace")) yield chunk tmp_file.rename(cache_file) -- cgit v1.2.3