eaglelandsonce commited on
Commit
8750972
·
verified ·
1 Parent(s): f1d9431

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -41
app.py CHANGED
@@ -235,49 +235,49 @@ with tab1:
235
  '''
236
  st.markdown(query)
237
 
238
- # Displaying the audio player below the text
239
-
240
- voice_option = st.selectbox(
241
- 'Choose a voice:',
242
- ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']
243
- )
244
-
245
- if st.button('Convert to Speech'):
246
- if query:
247
- try:
248
- response = oai_client.audio.speech.create(
249
- model="tts-1",
250
- voice=voice_option,
251
- input=query,
252
- )
253
-
254
- # Stream or save the response as needed
255
- # For demonstration, let's assume we save then provide a link for downloading
256
- audio_file_path = "output.mp3"
257
- response.stream_to_file(audio_file_path)
258
-
259
- # Display audio file to download
260
- st.audio(audio_file_path, format='audio/mp3')
261
- st.success("Conversion successful!")
262
-
263
- # Displaying the image with the same name as the selected scene
264
- image_file_path = f"./data/{selected_scene}.jpg" # Adjust the directory as needed
265
- try:
266
- st.image(image_file_path, caption=f"Scene: {selected_scene}")
267
- """All images generated by Dall-E"""
268
- except Exception as e:
269
- st.error(f"An error occurred while displaying the image: {e}")
270
-
271
- except Exception as e:
272
- st.error(f"An error occurred: {e}")
273
- else:
274
- st.error("Please enter some text to convert.")
275
- #st.audio('intro_audio.mp3')
276
 
 
 
 
 
277
 
278
- st.header("Custom GPT Engineering Tools")
279
- st.link_button("Create JSON Data for a Green Data Village Population 10,000", "https://chat.openai.com/g/g-4bPJUaHS8-create-a-green-data-village")
280
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
281
  st.write("Explanation of the Custom GPT")
282
  st.write("""
283
  On clicking "Create Data Village" create a Green Data Village following the 4 Steps below. Output a JSON file similar to the Example by complete the four Steps.
 
235
  '''
236
  st.markdown(query)
237
 
238
+ # Displaying the audio player below the text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
 
240
+ voice_option = st.selectbox(
241
+ 'Choose a voice:',
242
+ ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer']
243
+ )
244
 
245
+ if st.button('Convert to Speech'):
246
+ if query:
247
+ try:
248
+ response = oai_client.audio.speech.create(
249
+ model="tts-1",
250
+ voice=voice_option,
251
+ input=query,
252
+ )
253
+
254
+ # Stream or save the response as needed
255
+ # For demonstration, let's assume we save then provide a link for downloading
256
+ audio_file_path = "output.mp3"
257
+ response.stream_to_file(audio_file_path)
258
+
259
+ # Display audio file to download
260
+ st.audio(audio_file_path, format='audio/mp3')
261
+ st.success("Conversion successful!")
262
+
263
+ # Displaying the image with the same name as the selected scene
264
+ image_file_path = f"./data/{selected_scene}.jpg" # Adjust the directory as needed
265
+ try:
266
+ st.image(image_file_path, caption=f"Scene: {selected_scene}")
267
+ """All images generated by Dall-E"""
268
+ except Exception as e:
269
+ st.error(f"An error occurred while displaying the image: {e}")
270
+
271
+ except Exception as e:
272
+ st.error(f"An error occurred: {e}")
273
+ else:
274
+ st.error("Please enter some text to convert.")
275
+ #st.audio('intro_audio.mp3')
276
+
277
+
278
+ st.header("Custom GPT Engineering Tools")
279
+ st.link_button("Create JSON Data for a Green Data Village Population 10,000", "https://chat.openai.com/g/g-4bPJUaHS8-create-a-green-data-village")
280
+
281
  st.write("Explanation of the Custom GPT")
282
  st.write("""
283
  On clicking "Create Data Village" create a Green Data Village following the 4 Steps below. Output a JSON file similar to the Example by complete the four Steps.