Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when I use api to convert text file to audio #91

Open
kerlynla opened this issue Aug 29, 2024 · 0 comments
Open

Error when I use api to convert text file to audio #91

kerlynla opened this issue Aug 29, 2024 · 0 comments

Comments

@kerlynla
Copy link

I used xtts.py :
from gradio_client import Client

client = Client("http://127.0.0.1:8010/")
result = client.predict(
2, # float (numeric value between 2 and 40) in 'Chunk seconds (more secods more VRAM usage and faster inference speed)' Slider component
0.1, # float (numeric value between 0.1 and 2) in 'Overlap seconds' Slider component
"Midpoint", # Literal['Midpoint', 'RK4', 'Euler'] in 'CFM ODE Solver (Midpoint is recommended)' Dropdown component
1, # float (numeric value between 1 and 128) in 'CFM Number of Function Evaluations (higher values in general yield better quality but may be slower)' Slider component
0, # float (numeric value between 0 and 1) in 'CFM Prior Temperature (higher values can improve quality but can reduce stability)' Slider component
True, # bool in 'Denoise Before Enhancement (tick if your audio contains heavy background noise)' Checkbox component
"Hello!!", # str in 'RVC Model' Textbox component
"Hello!!", # str in 'Index file' Textbox component
"None", # Literal[] in 'RVC Model name' Dropdown component
-24, # float (numeric value between -24 and 24) in 'Pitch' Slider component
0, # float (numeric value between 0 and 1) in 'Index rate' Slider component
0, # float (numeric value between 0 and 0.5) in 'Protect voiceless' Slider component
"crepe", # Literal['crepe', 'pm', 'rmvpe', 'harvest'] in 'RVC Method' Radio component
0, # float (numeric value between 0 and 7) in 'If >=3: apply median filtering to the harvested pitch results. The value represents the filter radius and can reduce breathiness.' Slider component
0, # float (numeric value between 0 and 48000) in 'Resample the output audio in post-processing to the final sample rate. Set to 0 for no resampling' Slider component
0, # float (numeric value between 0 and 1) in 'Use the volume envelope of the input to replace or mix with the volume envelope of the output. The closer the ratio is to 1, the more the output envelope is used' Slider component
"42.mp3", # Literal['42.mp3'] in 'Reference sample' Dropdown component
["https://github.com/gradio-app/gradio/raw/main/test/test_files/sample_file.pdf"], # List[filepath] in 'Upload .txt files' File component
r"C:\Users\admin\Desktop\test112.txt", # str in 'Path to folder with .txt files, Has priority over all ' Textbox component
"Hello!!", # str in 'parameter_128' Textbox component
["https://github.com/gradio-app/gradio/raw/main/test/test_files/sample_file.pdf"], # List[filepath] in 'Upload srt or ass files' File component
"Hello!!", # str in 'Path to folder with srt or ass, Has priority over all' Textbox component
True, # bool in 'Synchronise subtitle timings' Checkbox component
False, # bool in 'Enable language auto detect' Checkbox component
False, # bool in 'Enable Waveform' Checkbox component
False, # bool in 'Improve output quality' Checkbox component
False, # bool in 'Resemble enhancement' Checkbox component
"None", # Literal['RVC', 'OpenVoice', 'None'] in 'Use RVC or OpenVoice to improve result' Radio component
"mp3", # Literal['mp3', 'wav'] in 'Output Type' Radio component
"Hello!!", # str in 'Input Text' Textbox component
"Vietnamese", # Literal['Vietnamese', 'Arabic', 'Brazilian Portuguese', 'Chinese', 'Czech', 'Dutch', 'English', 'French', 'German', 'Italian', 'Polish', 'Russian', 'Spanish', 'Turkish', 'Japanese', 'Korean', 'Hindi'] in 'Language' Dropdown component
"Hello!!", # str in 'Reference Speaker Name' Textbox component
"Hello!!", # str in 'Reference Speaker Path' Textbox component
"Hello!!", # str in 'File Name Value' Textbox component
"XTTS", # Literal['XTTS', 'SILERO'] in 'Select Voice Engine' Radio component
0.01, # float (numeric value between 0.01 and 1) in 'Temperature' Slider component
-10, # float (numeric value between -10.0 and 10.0) in 'Length Penalty' Slider component
1, # float (numeric value between 1 and 10) in 'Repetition Penalty' Slider component
1, # float (numeric value between 1 and 100) in 'Top K' Slider component
0.01, # float (numeric value between 0.01 and 1) in 'Top P' Slider component
0.1, # float (numeric value between 0.1 and 2) in 'speed' Slider component
True, # bool in 'Enable text splitting' Checkbox component
{"label":"Cat","confidences":[{"label":"cat","confidence":0.9},{"label":"dog","confidence":0.1}]}, # Dict(label: str | int | float | None, confidences: List[Dict(label: str | int | float | None, confidence: float | None)] | None) in 'Status bar' Label component
api_name="/generate_audio"
)
print(result)

When I ran, it appeared an error:
Loaded as API: http://127.0.0.1:8010/
Traceback (most recent call last):
File "G:\Chuan-audio backup\xtts\xtts.py", line 4, in
result = client.predict(
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio_client\client.py", line 468, in predict
).result()
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio_client\client.py", line 1499, in result
return super().result(timeout=timeout)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 458, in result
return self.__get_result()
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\concurrent\futures_base.py", line 403, in __get_result
raise self._exception
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\concurrent\futures\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio_client\client.py", line 1121, in _inner
predictions = _predict(*data)
File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\gradio_client\client.py", line 1238, in _predict
raise AppError(
gradio_client.exceptions.AppError: The upstream Gradio app has raised an exception: 1 validation error for ListFiles
0
Input should be a valid dictionary or instance of FileData [type=model_type, input_value='https://github.com/gradi...t_files/sample_file.pdf', input_type=str]
For further information visit https://errors.pydantic.dev/2.7/v/model_type

Can you guide me to fix it?
Thank you so much

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant