From 5b174bab359e01e8a1f0ab651874987bc0e37add Mon Sep 17 00:00:00 2001 From: erew123 <35898566+erew123@users.noreply.github.com> Date: Sun, 17 Dec 2023 05:45:51 +0000 Subject: [PATCH] pull params correctly into HTML Only affects custom IP/ports. No changes otherwise. --- tts_server.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tts_server.py b/tts_server.py index a97439c..f3f3a0a 100644 --- a/tts_server.py +++ b/tts_server.py @@ -20,6 +20,7 @@ from fastapi import ( from fastapi.responses import JSONResponse, HTMLResponse, RedirectResponse, FileResponse from fastapi.templating import Jinja2Templates from fastapi.staticfiles import StaticFiles +from jinja2 import Template from contextlib import asynccontextmanager ########################### @@ -517,7 +518,6 @@ def list_files(directory): # Create an instance of Jinja2Templates for rendering HTML templates templates = Jinja2Templates(directory=this_dir / "templates") - # Create a dependency to get the current JSON data def get_json_data(): with open(this_dir / "config.json", "r") as json_file: @@ -783,10 +783,10 @@ simple_webpage = """
Text generation webUI webpage here and documentation here
+Text generation webUI webpage here and documentation here
AllTalk Github here - +
http://127.0.0.1:7851http://127.0.0.1:7851/readyhttp://{{ params["ip_address"] }}:{{ params["port_number"] }}http://{{ params["ip_address"] }}:{{ params["port_number"] }}/readyIts possible to set a custom model for the API Local and XTTSv2 Local methods, or ideed point it at the same model that API TTS uses (wherever it is stored on your OS of choice). Many people did not like the sound quality of the Coqui 2.0.3 model, and as such the AllTalk tts extension downloads the 2.0.2 model seperately to the 2.0.3 model that TTS service downloads and manages. Typically the 2.0.2 model is stored in your /extensions/alltalk_tts/models folder and it is always downloaded on first start-up of the AllTalk_tts extension. However, you may either want to use a custom model version of your choosing, or point it to a different path on your system, or even point it so that API Local and XTTSv2 both use the same model that API TTS is using.
+Its possible to set a custom model for the API Local and XTTSv2 Local methods, or indeed point it at the same model that API TTS uses (wherever it is stored on your OS of choice). Many people did not like the sound quality of the Coqui 2.0.3 model, and as such the AllTalk tts extension downloads the 2.0.2 model seperately to the 2.0.3 model that TTS service downloads and manages. Typically the 2.0.2 model is stored in your /extensions/alltalk_tts/models folder and it is always downloaded on first start-up of the AllTalk_tts extension. However, you may either want to use a custom model version of your choosing, or point it to a different path on your system, or even point it so that API Local and XTTSv2 both use the same model that API TTS is using.
If you do choose to change the location there are a couple of things to note.
- The folder you place the model in, cannot be called "models". This name is reserved solely for the system to identify you are or are not using a custom model.
- On each startup, the AllTalk tts extension will check the custom location and if it does not exist, it will create it and download the files it needs. It will also re download any missing files in that location that are needed for the model to function.
@@ -1240,18 +1240,22 @@ simple_webpage = """ """ - ################################################### #### Webserver Startup & Initial model Loading #### ################################################### +# Create a Jinja2 template object +template = Template(simple_webpage) + +# Render the template with the dynamic values +rendered_html = template.render(params=params) + @app.get("/ready") async def ready(): return Response("Ready endpoint") - @app.get("/") async def read_root(): - return HTMLResponse(content=simple_webpage, status_code=200) + return HTMLResponse(content=rendered_html, status_code=200) # Start Uvicorn Webserver host_parameter = {params["ip_address"]}