File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed
apps/99_streamlit_examples/pages Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 1
1
# Azure OpenAI Service
2
2
AZURE_OPENAI_ENDPOINT = " https://<YOUR_AOAI_NAME>.openai.azure.com/"
3
3
AZURE_OPENAI_API_KEY = " <YOUR_API_KEY>"
4
- AZURE_OPENAI_API_VERSION = " 2024-06 -01"
4
+ AZURE_OPENAI_API_VERSION = " 2024-07 -01-preview "
5
5
AZURE_OPENAI_GPT_MODEL = " gpt-4o"
6
6
AZURE_OPENAI_STT_MODEL = " whisper"
7
- AZURE_OPENAI_TTS_VOICE = " alloy"
8
7
AZURE_OPENAI_TTS_MODEL = " tts-hd"
9
8
AZURE_OPENAI_EMBEDDING_MODEL = " text-embedding-3-large"
10
9
AZURE_OPENAI_DALLE_MODEL = " dall-e-3"
Original file line number Diff line number Diff line change 48
48
)
49
49
st .write (f"You wrote { len (content )} characters." )
50
50
51
- if st .button ("Convert" ):
51
+ voice_option = st .selectbox (
52
+ "Select voice" ,
53
+ (
54
+ "alloy" ,
55
+ "echo" ,
56
+ "fable" ,
57
+ "onyx" ,
58
+ "nova" ,
59
+ "shimmer" ,
60
+ ),
61
+ )
62
+
63
+ convert_button = st .button ("Convert" )
64
+ if convert_button and content and voice_option :
52
65
client = AzureOpenAI (
53
66
api_key = azure_openai_api_key ,
54
67
api_version = azure_openai_api_version ,
59
72
with st .spinner ("Converting..." ):
60
73
response = client .audio .speech .create (
61
74
input = content ,
62
- voice = getenv ( "AZURE_OPENAI_TTS_VOICE" ) ,
75
+ voice = voice_option ,
63
76
model = azure_openai_tts_model ,
64
77
response_format = "mp3" ,
65
78
)
You can’t perform that action at this time.
0 commit comments