Fix gradio Path serialize error

This commit is contained in:
litagin02
2024-05-19 18:31:45 +09:00
parent 0a3b57528b
commit 053a6bf785
2 changed files with 7 additions and 3 deletions

View File

@@ -260,7 +260,9 @@ def create_inference_app(model_holder: TTSModelHolder) -> gr.Blocks:
) )
return app return app
initial_id = 0 initial_id = 0
initial_pth_files = model_holder.model_files_dict[model_names[initial_id]] initial_pth_files = [
str(f) for f in model_holder.model_files_dict[model_names[initial_id]]
]
with gr.Blocks(theme=GRADIO_THEME) as app: with gr.Blocks(theme=GRADIO_THEME) as app:
gr.Markdown(initial_md) gr.Markdown(initial_md)

View File

@@ -483,7 +483,7 @@ class TTSModelHolder:
def update_model_files_for_gradio(self, model_name: str): def update_model_files_for_gradio(self, model_name: str):
import gradio as gr import gradio as gr
model_files = self.model_files_dict[model_name] model_files = [str(f) for f in self.model_files_dict[model_name]]
return gr.Dropdown(choices=model_files, value=model_files[0]) # type: ignore return gr.Dropdown(choices=model_files, value=model_files[0]) # type: ignore
def update_model_names_for_gradio( def update_model_names_for_gradio(
@@ -493,7 +493,9 @@ class TTSModelHolder:
self.refresh() self.refresh()
initial_model_name = self.model_names[0] initial_model_name = self.model_names[0]
initial_model_files = self.model_files_dict[initial_model_name] initial_model_files = [
str(f) for f in self.model_files_dict[initial_model_name]
]
return ( return (
gr.Dropdown(choices=self.model_names, value=initial_model_name), # type: ignore gr.Dropdown(choices=self.model_names, value=initial_model_name), # type: ignore
gr.Dropdown(choices=initial_model_files, value=initial_model_files[0]), # type: ignore gr.Dropdown(choices=initial_model_files, value=initial_model_files[0]), # type: ignore