Download gemma.cpp/build/_deps/json-src/docs/examples/accept__string.cpp from ZeroWw/gemma-2-9b-SBS: direct link, hf CLI and curl.
- Browser
- Download file 466 Bytes
-
https://huggingface.co/ZeroWw/gemma-2-9b-SBS/resolve/main/gemma.cpp/build/_deps/json-src/docs/examples/accept__string.cpp
- Command line
-
hf download hf://ZeroWw/gemma-2-9b-SBS/gemma.cpp/build/_deps/json-src/docs/examples/accept__string.cpp
-
curl -L -o accept__string.cpp https://huggingface.co/ZeroWw/gemma-2-9b-SBS/resolve/main/gemma.cpp/build/_deps/json-src/docs/examples/accept__string.cpp
466 Bytes
| using json = nlohmann::json; | |
| int main() | |
| { | |
| // a valid JSON text | |
| auto valid_text = R"( | |
| { | |
| "numbers": [1, 2, 3] | |
| } | |
| )"; | |
| // an invalid JSON text | |
| auto invalid_text = R"( | |
| { | |
| "strings": ["extra", "comma", ] | |
| } | |
| )"; | |
| std::cout << std::boolalpha | |
| << json::accept(valid_text) << ' ' | |
| << json::accept(invalid_text) << '\n'; | |
| } | |