CoolFace
Apppublic

Jafta/Yarn-Mistral-API

sourceHugging Faceupdated 3y agoView on Hugging Face
1likes
main.py28 linesDownload Raw Back to root
1from llama_cpp.server.app import create_app, Settings2from fastapi.responses import HTMLResponse3import os4 5app = create_app(6    Settings(7        n_threads=2,  # set to number of cpu cores8        model="model/gguf-model.bin",9        embedding=True10    )11)12 13# Read the content of index.html once and store it in memory14with open("index.html", "r") as f:15    content = f.read()16 17 18@app.get("/", response_class=HTMLResponse)19async def read_items():20    return content21 22if __name__ == "__main__":23    import uvicorn24    uvicorn.run(app,25                host=os.environ["HOST"],26                port=int(os.environ["PORT"])27                )28