sinapsis 0.2.3__tar.gz → 0.2.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sinapsis-0.2.3 → sinapsis-0.2.5}/PKG-INFO +1 -1
- {sinapsis-0.2.3 → sinapsis-0.2.5}/pyproject.toml +1 -1
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis/webapp/agent_gradio_helper.py +2 -3
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis/webapp/tts_base.py +11 -15
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis.egg-info/PKG-INFO +1 -1
- {sinapsis-0.2.3 → sinapsis-0.2.5}/LICENSE +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/README.md +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/setup.cfg +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis/__init__.py +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis/bin/sinapsis_cli.py +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis/templates/__init__.py +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis/templates/display_hello_world.py +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis/templates/hello_world.py +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis/webapp/__init__.py +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis/webapp/agent_webapp_utils.py +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis/webapp/chatbot_base.py +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis.egg-info/SOURCES.txt +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis.egg-info/dependency_links.txt +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis.egg-info/entry_points.txt +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis.egg-info/requires.txt +0 -0
- {sinapsis-0.2.3 → sinapsis-0.2.5}/src/sinapsis.egg-info/top_level.txt +0 -0
|
@@ -119,12 +119,11 @@ def add_logo_and_title(page_title: str | None = None) -> None:
|
|
|
119
119
|
gr.Image(
|
|
120
120
|
logo_path,
|
|
121
121
|
elem_id="sinapsis-logo",
|
|
122
|
-
|
|
123
|
-
height=150,
|
|
122
|
+
height=50,
|
|
124
123
|
show_label=False,
|
|
125
124
|
show_download_button=False,
|
|
126
125
|
show_fullscreen_button=False,
|
|
127
|
-
scale=
|
|
126
|
+
scale=1,
|
|
128
127
|
)
|
|
129
128
|
|
|
130
129
|
gr.Markdown(f"# {page_title}", elem_id="title")
|
|
@@ -6,7 +6,7 @@ from sinapsis_core.agent import Agent
|
|
|
6
6
|
from sinapsis_core.cli.run_agent_from_config import generic_agent_builder
|
|
7
7
|
from sinapsis_core.data_containers.data_packet import DataContainer, TextPacket
|
|
8
8
|
|
|
9
|
-
from sinapsis.webapp.agent_gradio_helper import add_logo_and_title
|
|
9
|
+
from sinapsis.webapp.agent_gradio_helper import add_logo_and_title, css_header
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class BaseTTSApp:
|
|
@@ -17,7 +17,7 @@ class BaseTTSApp:
|
|
|
17
17
|
def __init__(
|
|
18
18
|
self,
|
|
19
19
|
config_file: str,
|
|
20
|
-
|
|
20
|
+
generic_key_or_base_path: str | None = None,
|
|
21
21
|
framework: str = "Elevenlabs",
|
|
22
22
|
task: str = "Text-to-Speech",
|
|
23
23
|
) -> None:
|
|
@@ -27,7 +27,8 @@ class BaseTTSApp:
|
|
|
27
27
|
Args:
|
|
28
28
|
config_file (str): Path to the configuration file for the TTS application, which contains
|
|
29
29
|
necessary settings and parameters.
|
|
30
|
-
|
|
30
|
+
generic_key_or_base_path (str | None): Optional key to access the container's generic data or the base_path
|
|
31
|
+
where audios are located
|
|
31
32
|
framework (str, optional): The name of the framework to be used in the user interface title.
|
|
32
33
|
Defaults to Elevenlabs.
|
|
33
34
|
task (str, optional): The task to be performed by the application (default is "Text-to-Speech").
|
|
@@ -36,7 +37,7 @@ class BaseTTSApp:
|
|
|
36
37
|
self.config_file = config_file
|
|
37
38
|
self.framework = framework
|
|
38
39
|
self.task = task
|
|
39
|
-
self.
|
|
40
|
+
self.generic_key_or_base_path = generic_key_or_base_path
|
|
40
41
|
|
|
41
42
|
def init_agent(self) -> tuple[Agent, bool]:
|
|
42
43
|
"""
|
|
@@ -82,7 +83,7 @@ class BaseTTSApp:
|
|
|
82
83
|
agent = cast(Agent, agent)
|
|
83
84
|
container = DataContainer(texts=[TextPacket(content=text_to_convert)])
|
|
84
85
|
output_container = agent(container)
|
|
85
|
-
audio_path = self._postprocess_output(output_container, self.
|
|
86
|
+
audio_path = self._postprocess_output(output_container, self.generic_key_or_base_path)
|
|
86
87
|
if audio_path:
|
|
87
88
|
return gr.Audio(audio_path, visible=True), None
|
|
88
89
|
raise gr.Error("Unable to generate speech")
|
|
@@ -101,8 +102,6 @@ class BaseTTSApp:
|
|
|
101
102
|
initialized_state = gr.State(False)
|
|
102
103
|
interface.load(self.init_agent, outputs=[agent_state, initialized_state])
|
|
103
104
|
|
|
104
|
-
title: str = f"# Sinapsis {self.framework} {self.task} demo"
|
|
105
|
-
gr.Markdown(title)
|
|
106
105
|
text_to_convert = gr.Textbox(
|
|
107
106
|
submit_btn=True,
|
|
108
107
|
label="Text to convert:",
|
|
@@ -125,19 +124,16 @@ class BaseTTSApp:
|
|
|
125
124
|
"""
|
|
126
125
|
Invokes the Gradio interface and displays the TTS functionality.
|
|
127
126
|
"""
|
|
128
|
-
with gr.Blocks() as tts_interface:
|
|
129
|
-
add_logo_and_title("Sinapsis
|
|
127
|
+
with gr.Blocks(css=css_header()) as tts_interface:
|
|
128
|
+
add_logo_and_title(f"Sinapsis {self.framework} {self.task} demo")
|
|
130
129
|
self.inner_tts_functionality(tts_interface)
|
|
131
130
|
return tts_interface
|
|
132
131
|
|
|
133
132
|
|
|
134
133
|
class TTSAppAudioFromPacket(BaseTTSApp):
|
|
135
|
-
BASE_AUDIO_PATH: str
|
|
136
134
|
"""
|
|
137
|
-
A subclass of BaseTTSApp for implementing text-to-speech functionality
|
|
138
|
-
|
|
139
|
-
This class overrides the abstract methods from BaseTTSApp to provide specific preprocessing
|
|
140
|
-
and postprocessing steps for the F5TTS application.
|
|
135
|
+
A subclass of BaseTTSApp for implementing text-to-speech functionality extracting the audio path
|
|
136
|
+
from the generic_data field of Containers.
|
|
141
137
|
"""
|
|
142
138
|
|
|
143
139
|
def _postprocess_output(self, container: DataContainer, generic_key: str | None) -> str | None:
|
|
@@ -148,7 +144,7 @@ class TTSAppAudioFromPacket(BaseTTSApp):
|
|
|
148
144
|
|
|
149
145
|
audio = container.audios[-1]
|
|
150
146
|
audio_path = f"{audio.source}-{audio.id.split('-')[0]}"
|
|
151
|
-
audio_path = f"{self.
|
|
147
|
+
audio_path = f"{self.generic_key_or_base_path}/{audio_path}.wav"
|
|
152
148
|
return audio_path
|
|
153
149
|
|
|
154
150
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|