@@ -38,6 +38,7 @@ export async function sendAndReceiveAudioPath(
3838 sample_rate : number ,
3939 temperature : number ,
4040 speed : number ,
41+ topP : number ,
4142 voice ?: string ,
4243 audioPath ?: string ,
4344) {
@@ -50,6 +51,7 @@ export async function sendAndReceiveAudioPath(
5051 sample_rate : sample_rate ,
5152 temperature : temperature ,
5253 speed : speed ,
54+ top_p : topP ,
5355 } ;
5456
5557 if ( voice ) {
@@ -170,6 +172,7 @@ export default function Audio() {
170172 const [ filePrefix , setFilePrefix ] = React . useState ( 'output_audio' ) ;
171173 const [ sampleRate , setSampleRate ] = React . useState ( 24000 ) ;
172174 const [ temperature , setTemperature ] = React . useState ( 0.7 ) ;
175+ const [ topP , setTopP ] = React . useState ( 1.0 ) ;
173176 const [ selectedLanguage , setSelectedLanguage ] = React . useState ( '' ) ;
174177 const [ selectedVoice , setSelectedVoice ] = React . useState ( '' ) ;
175178
@@ -200,6 +203,7 @@ export default function Audio() {
200203 sampleRate ,
201204 temperature ,
202205 speed ,
206+ topP ,
203207 selectedVoice || undefined ,
204208 uploadedAudioPath || undefined ,
205209 ) ;
@@ -371,6 +375,21 @@ export default function Audio() {
371375 />
372376 </ FormControl >
373377
378+ < FormControl >
379+ < FormLabel >
380+ Top P: < b > { topP . toFixed ( 2 ) } </ b >
381+ </ FormLabel >
382+ < Slider
383+ aria-label = "Top P"
384+ value = { topP }
385+ onChange = { ( _ , v ) => setTopP ( v as number ) }
386+ min = { 0.0 }
387+ max = { 1.0 }
388+ step = { 0.01 }
389+ valueLabelDisplay = "auto"
390+ />
391+ </ FormControl >
392+
374393 < FormControl >
375394 < FormLabel >
376395 Speech Speed: < b > { speed } x</ b >
0 commit comments