Spaces:
Runtime error
Runtime error
Download llama-cpp-python/examples/high_level_api/fastapi_server.py from aelitta/BioMistral_gradio: direct link, hf CLI and curl.
- Browser
- Download file 653 Bytes
-
https://huggingface.co/spaces/aelitta/BioMistral_gradio/resolve/main/llama-cpp-python/examples/high_level_api/fastapi_server.py
- Command line
-
hf download hf://spaces/aelitta/BioMistral_gradio/llama-cpp-python/examples/high_level_api/fastapi_server.py
-
curl -L -o fastapi_server.py https://huggingface.co/spaces/aelitta/BioMistral_gradio/resolve/main/llama-cpp-python/examples/high_level_api/fastapi_server.py
653 Bytes
| """Example FastAPI server for llama.cpp. | |
| To run this example: | |
| ```bash | |
| pip install fastapi uvicorn sse-starlette | |
| export MODEL=../models/7B/... | |
| ``` | |
| Then run: | |
| ``` | |
| uvicorn --factory llama_cpp.server.app:create_app --reload | |
| ``` | |
| or | |
| ``` | |
| python3 -m llama_cpp.server | |
| ``` | |
| Then visit http://localhost:8000/docs to see the interactive API docs. | |
| To actually see the implementation of the server, see llama_cpp/server/app.py | |
| """ | |
| import os | |
| import uvicorn | |
| from llama_cpp.server.app import create_app | |
| if __name__ == "__main__": | |
| app = create_app() | |
| uvicorn.run( | |
| app, host=os.getenv("HOST", "localhost"), port=int(os.getenv("PORT", 8000)) | |
| ) | |