-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
192 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: lollms_env | ||
channels: | ||
- defaults | ||
- conda-forge # Adds a wider selection of packages, especially for less common ones | ||
dependencies: | ||
- python=3.11 | ||
- numpy=1.26.* | ||
- pandas | ||
- pillow>=9.5.0 | ||
- pyyaml | ||
- requests | ||
- rich | ||
- scipy | ||
- tqdm | ||
- setuptools | ||
- wheel | ||
- psutil | ||
- pytest | ||
- gitpython | ||
- beautifulsoup4 | ||
- packaging | ||
- fastapi | ||
- uvicorn | ||
- pydantic | ||
- selenium | ||
- aiofiles | ||
- pip # Conda will manage pip installation | ||
- pip: | ||
- colorama | ||
- ascii-colors>=0.4.2 | ||
- python-multipart | ||
- python-socketio | ||
- python-socketio[client] | ||
- python-socketio[asyncio_client] | ||
- tiktoken | ||
- pipmaster>=0.1.7 | ||
- lollmsvectordb>=1.1.0 | ||
- freedom-search>=0.1.9 | ||
- scrapemaster>=0.2.0 | ||
- lollms_client>=0.7.5 | ||
- zipfile36 | ||
- freedom_search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
project: lollms_webui | ||
file: lollms_xtts.py | ||
author: ParisNeo | ||
description: | ||
This module contains a set of FastAPI routes that provide information about the Lord of Large Language and Multimodal Systems (LoLLMs) Web UI | ||
application. These routes allow users to | ||
""" | ||
from fastapi import APIRouter, Request, UploadFile, File, HTTPException | ||
from fastapi.responses import PlainTextResponse | ||
from lollms_webui import LOLLMSWebUI | ||
from pydantic import BaseModel | ||
from starlette.responses import StreamingResponse | ||
from lollms.types import MSG_OPERATION_TYPE | ||
from lollms.main_config import BaseConfig | ||
from lollms.utilities import find_next_available_filename, output_file_path_to_url, detect_antiprompt, remove_text_from_string, trace_exception, find_first_available_file_index, add_period, PackageManager | ||
from lollms.security import sanitize_path, validate_path, check_access | ||
from pathlib import Path | ||
from ascii_colors import ASCIIColors | ||
import os | ||
import platform | ||
|
||
# ----------------------- Defining router and main class ------------------------------ | ||
|
||
router = APIRouter() | ||
lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance() | ||
|
||
class Identification(BaseModel): | ||
client_id: str | ||
|
||
# ----------------------- voice ------------------------------ | ||
@router.post("/install_whisper") | ||
def install_whisper(data: Identification): | ||
check_access(lollmsElfServer, data.client_id) | ||
try: | ||
if lollmsElfServer.config.headless_server_mode: | ||
return {"status":False,"error":"Service installation is blocked when in headless mode for obvious security reasons!"} | ||
|
||
if lollmsElfServer.config.host!="localhost" and lollmsElfServer.config.host!="127.0.0.1": | ||
return {"status":False,"error":"Service installation is blocked when the server is exposed outside for very obvious reasons!"} | ||
|
||
lollmsElfServer.ShowBlockingMessage("Installing whisper library\nPlease stand by") | ||
from lollms.services.stt.whisper.lollms_whisper import install_whisper | ||
install_whisper(lollmsElfServer) | ||
ASCIIColors.success("Done") | ||
lollmsElfServer.HideBlockingMessage() | ||
return {"status":True} | ||
except Exception as ex: | ||
lollmsElfServer.HideBlockingMessage() | ||
lollmsElfServer.InfoMessage(f"It looks like I could not install whisper because of this error:\n{ex}") | ||
return {"status":False, 'error':str(ex)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
""" | ||
project: lollms_webui | ||
file: lollms_xtts.py | ||
author: ParisNeo | ||
description: | ||
This module contains a set of FastAPI routes that provide information about the Lord of Large Language and Multimodal Systems (LoLLMs) Web UI | ||
application. These routes allow users to | ||
""" | ||
from fastapi import APIRouter, Request, UploadFile, File, HTTPException | ||
from fastapi.responses import PlainTextResponse | ||
from lollms_webui import LOLLMSWebUI | ||
from pydantic import BaseModel | ||
from starlette.responses import StreamingResponse | ||
from lollms.types import MSG_OPERATION_TYPE | ||
from lollms.main_config import BaseConfig | ||
from lollms.utilities import find_next_available_filename, output_file_path_to_url, detect_antiprompt, remove_text_from_string, trace_exception, find_first_available_file_index, add_period, PackageManager | ||
from lollms.security import sanitize_path, validate_path, check_access | ||
from pathlib import Path | ||
from ascii_colors import ASCIIColors | ||
import os | ||
import platform | ||
|
||
# ----------------------- Defining router and main class ------------------------------ | ||
|
||
router = APIRouter() | ||
lollmsElfServer:LOLLMSWebUI = LOLLMSWebUI.get_instance() | ||
|
||
class Identification(BaseModel): | ||
client_id: str | ||
|
||
# ----------------------- voice ------------------------------ | ||
@router.post("/install_xtts") | ||
def install_xtts(data: Identification): | ||
check_access(lollmsElfServer, data.client_id) | ||
try: | ||
if lollmsElfServer.config.headless_server_mode: | ||
return {"status":False,"error":"Service installation is blocked when in headless mode for obvious security reasons!"} | ||
|
||
if lollmsElfServer.config.host!="localhost" and lollmsElfServer.config.host!="127.0.0.1": | ||
return {"status":False,"error":"Service installation is blocked when the server is exposed outside for very obvious reasons!"} | ||
|
||
lollmsElfServer.ShowBlockingMessage("Installing XTTS library\nPlease stand by") | ||
from lollms.services.tts.xtts.lollms_xtts import xtts_install | ||
xtts_install(lollmsElfServer) | ||
ASCIIColors.success("Done") | ||
lollmsElfServer.HideBlockingMessage() | ||
return {"status":True} | ||
except Exception as ex: | ||
lollmsElfServer.HideBlockingMessage() | ||
lollmsElfServer.InfoMessage(f"It looks like I could not install XTT because of this error:\n{ex}") | ||
return {"status":False, 'error':str(ex)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Title LollmsWhisper | ||
# Licence: MIT | ||
# Author : Paris Neo | ||
# | ||
|
||
from pathlib import Path | ||
import whisper | ||
|
||
|
||
if __name__ == "__main__": | ||
# Create a mock LollmsApplication instance | ||
w = whisper.load_model("small") | ||
# Example usage | ||
audio_file_path = Path(r"E:\lollms\custom_voices\ParisNeo_Original_voice.wav") | ||
|
||
if audio_file_path.exists(): | ||
transcription = w.transcribe(str(audio_file_path)) | ||
print("Transcription:") | ||
print(transcription) | ||
else: | ||
print(f"Audio file not found: {audio_file_path}") |