Spaces:
Running
Running
Download solutions/stream_answer.py from jericrealubit/ragchatbot: direct link, hf CLI and curl.
- Browser
- Download file 298 Bytes
-
https://huggingface.co/spaces/jericrealubit/ragchatbot/resolve/main/solutions/stream_answer.py
- Command line
-
hf download hf://spaces/jericrealubit/ragchatbot/solutions/stream_answer.py
-
curl -L -o stream_answer.py https://huggingface.co/spaces/jericrealubit/ragchatbot/resolve/main/solutions/stream_answer.py
298 Bytes
| from ctransformers import AutoModelForCausalLM | |
| llm = AutoModelForCausalLM.from_pretrained( | |
| "zoltanctoth/orca_mini_3B-GGUF", model_file="orca-mini-3b.q4_0.gguf" | |
| ) | |
| prompt = "The name of the capital of India is" | |
| for word in llm(prompt, stream=True): | |
| print(word, end="", flush=True) | |
| print() | |