@@ -37,6 +37,7 @@ export async function sendAndReceiveAudioPath(
3737 sample_rate : number ,
3838 temperature : number ,
3939 speed : number ,
40+ topP : number ,
4041 voice ?: string ,
4142 audioPath ?: string ,
4243) {
@@ -49,6 +50,7 @@ export async function sendAndReceiveAudioPath(
4950 sample_rate : sample_rate ,
5051 temperature : temperature ,
5152 speed : speed ,
53+ top_p : topP ,
5254 } ;
5355
5456 if ( voice ) {
@@ -167,6 +169,7 @@ export default function Audio() {
167169 const [ filePrefix , setFilePrefix ] = React . useState ( 'output_audio' ) ;
168170 const [ sampleRate , setSampleRate ] = React . useState ( 24000 ) ;
169171 const [ temperature , setTemperature ] = React . useState ( 0.7 ) ;
172+ const [ topP , setTopP ] = React . useState ( 1.0 ) ;
170173 const [ selectedLanguage , setSelectedLanguage ] = React . useState ( '' ) ;
171174 const [ selectedVoice , setSelectedVoice ] = React . useState ( '' ) ;
172175
@@ -197,6 +200,7 @@ export default function Audio() {
197200 sampleRate ,
198201 temperature ,
199202 speed ,
203+ topP ,
200204 selectedVoice || undefined ,
201205 uploadedAudioPath || undefined ,
202206 ) ;
@@ -367,6 +371,21 @@ export default function Audio() {
367371 />
368372 </ FormControl >
369373
374+ < FormControl >
375+ < FormLabel >
376+ Top P: < b > { topP . toFixed ( 2 ) } </ b >
377+ </ FormLabel >
378+ < Slider
379+ aria-label = "Top P"
380+ value = { topP }
381+ onChange = { ( _ , v ) => setTopP ( v as number ) }
382+ min = { 0.0 }
383+ max = { 1.0 }
384+ step = { 0.01 }
385+ valueLabelDisplay = "auto"
386+ />
387+ </ FormControl >
388+
370389 < FormControl >
371390 < FormLabel >
372391 Speech Speed: < b > { speed } x</ b >
0 commit comments