eaglelandsonce commited on
Commit
cdd7baf
·
verified ·
1 Parent(s): 3c12ec8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -3
app.py CHANGED
@@ -228,17 +228,54 @@ with tab1:
228
 
229
  # Displaying the text above on the right
230
  with col2:
231
- st.markdown('''
232
  On his first day at Quantum Data Institute in Green Open Data City Aya, Elian marveled at the city’s harmonious blend of technology and nature.
233
  Guided to his mentor, Dr. Maya Lior, a pioneer in urban data ecosystems, their discussion quickly centered on Aya’s innovative design.
234
  Dr. Lior explained data analytics and green technologies were intricately woven into the city's infrastructure, and how they used
235
  a Custom GPT called Green Data City to create the design.
236
 
237
  To interact with the Green Data City design tool click the button below.
238
- ''')
 
239
 
240
  # Displaying the audio player below the text
241
- st.audio('intro_audio.mp3')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
 
243
 
244
  st.header("Custom GPT Engineering Tools")
 
228
 
229
  # Displaying the text above on the right
230
  with col2:
231
+ query = '''
232
  On his first day at Quantum Data Institute in Green Open Data City Aya, Elian marveled at the city’s harmonious blend of technology and nature.
233
  Guided to his mentor, Dr. Maya Lior, a pioneer in urban data ecosystems, their discussion quickly centered on Aya’s innovative design.
234
  Dr. Lior explained data analytics and green technologies were intricately woven into the city's infrastructure, and how they used
235
  a Custom GPT called Green Data City to create the design.
236
 
237
  To interact with the Green Data City design tool click the button below.
238
+ '''
239
+ st.markdown(query)
240
 
241
  # Displaying the audio player below the text
242
+
243
+ voice_option = st.selectbox(
244
+ 'Choose a voice:',
245
+ ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']
246
+ )
247
+
248
+ if st.button('Convert to Speech'):
249
+ if query:
250
+ try:
251
+ response = oai_client.audio.speech.create(
252
+ model="tts-1",
253
+ voice=voice_option,
254
+ input=query,
255
+ )
256
+
257
+ # Stream or save the response as needed
258
+ # For demonstration, let's assume we save then provide a link for downloading
259
+ audio_file_path = "output.mp3"
260
+ response.stream_to_file(audio_file_path)
261
+
262
+ # Display audio file to download
263
+ st.audio(audio_file_path, format='audio/mp3')
264
+ st.success("Conversion successful!")
265
+
266
+ # Displaying the image with the same name as the selected scene
267
+ image_file_path = f"./data/{selected_scene}.jpg" # Adjust the directory as needed
268
+ try:
269
+ st.image(image_file_path, caption=f"Scene: {selected_scene}")
270
+ """All images generated by Dall-E"""
271
+ except Exception as e:
272
+ st.error(f"An error occurred while displaying the image: {e}")
273
+
274
+ except Exception as e:
275
+ st.error(f"An error occurred: {e}")
276
+ else:
277
+ st.error("Please enter some text to convert.")
278
+ #st.audio('intro_audio.mp3')
279
 
280
 
281
  st.header("Custom GPT Engineering Tools")