upgraded installer

This commit is contained in:
Saifeddine ALOUI 2024-01-01 02:34:04 +01:00
parent b54b60f18d
commit 327d375e19
5 changed files with 25 additions and 20 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue</title>
<script type="module" crossorigin src="/assets/index-VYnTPOR7.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-JgHIdFqq.css">
<script type="module" crossorigin src="/assets/index-cg9k10ae.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-9yYAPY-Y.css">
</head>
<body>
<div id="app"></div>

View File

@ -1,6 +1,10 @@
<template>
<div class="flex flex-col items-center justify-center min-h-screen">
<h1 class="text-4xl font-bold mb-4">Install lollms</h1>
<div class="flex flex-col items-center justify-center rounded-lg m-2 shadow-lg hover:border-primary dark:hover:border-primary hover:border-solid hover:border-2 border-2 border-transparent even:bg-bg-light-discussion-odd dark:even:bg-bg-dark-discussion-odd flex flex-col flex-grow flex-wrap overflow-visible p-4 pb-2">
<h1 class="text-4xl font-bold mb-4">LOLLMS installation tool</h1>
<p class="text-left">
Welcome to the installer of lollms. Here you can select your install profile.<br>
Let's start by selecting the install mode.<br><br>
</p>
<div class="flex flex-col gap-2">
<label class="flex items-center">
<input type="radio" value="nvidia" v-model="selectedOption" class="mr-2">

View File

@ -3,6 +3,7 @@ from fastapi.staticfiles import StaticFiles
from pydantic import BaseModel
import uvicorn
from lollms.paths import LollmsPaths
from lollms.main_config import LOLLMSConfig
from lollms.utilities import check_and_install_torch, PackageManager
from pathlib import Path
from ascii_colors import ASCIIColors
@ -11,11 +12,13 @@ from pathlib import Path
from starlette.responses import FileResponse
from starlette.requests import Request
import webbrowser
root_path =Path(__file__).parent.parent.parent.parent
root_path = Path(__file__).parent.parent.parent.parent
global_path = root_path/"global_paths_cfg.yaml"
ASCIIColors.yellow(f"global_path: {global_path}")
lollms_paths = LollmsPaths(global_path)
config = LOLLMSConfig(lollms_paths.personal_configuration_path/"local_config.yaml")
shared_folder = lollms_paths.personal_path/"shared"
sd_folder = shared_folder / "auto_sd"
output_dir = lollms_paths.personal_path / "outputs/sd"
@ -33,24 +36,32 @@ ASCIIColors.red(" LoLLMS configuratoin tool")
ASCIIColors.yellow(f"Root dir : {root_path}")
app = FastAPI(debug=True)
class Item(BaseModel):
name: str
price: float
class InstallProperties(BaseModel):
mode: str
# Serve the index.html file for all routes
@app.get("/{full_path:path}")
async def serve_index(request: Request, full_path: Path):
if str(full_path).endswith(".js"):
return FileResponse(root_path/"scripts/python/lollms_installer/frontend/dist"/full_path, media_type="application/javascript")
if str(full_path).endswith(".css"):
return FileResponse(root_path/"scripts/python/lollms_installer/frontend/dist"/full_path)
return FileResponse(root_path/"scripts/python/lollms_installer/frontend/dist/index.html")
app.mount("/", StaticFiles(directory=root_path/"scripts/python/lollms_installer/frontend/dist"), name="static")
@app.post("/start_installing")
def start_installing(item: Item):
def start_installing(data: InstallProperties):
if data=="cpu":
config.enable_gpu=False
config.save_config()
else:
config.enable_gpu=True
config.save_config()
# Your code here
return {"message": "Item created successfully"}
if __name__ == "__main__":
webbrowser.open(f"http://localhost:8000")
uvicorn.run(app, host="0.0.0.0", port=8000)