eaglelandsonce commited on
Commit
32e6730
·
verified ·
1 Parent(s): 2c5680a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -31
app.py CHANGED
@@ -613,41 +613,48 @@ with tab3:
613
  # Display the graph
614
  agraph(nodes=graph_store.getNodes(), edges=graph_store.getEdges(), config=agraph_config)
615
 
616
- image = Image.open('./data/incentive_image.jpg')
617
- st.image(image, caption='Sensor Insentive Program')
618
 
619
- st.markdown(query2)
620
-
621
- # Displaying the audio player below the text
622
- voice_option3 = st.selectbox(
623
- 'Choose a voice:',
624
- ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'],key='key5'
625
- )
626
-
627
 
628
- if st.button('Convert to Speech', key='key6'):
629
- if query2:
630
- try:
631
- response = oai_client.audio.speech.create(
632
- model="tts-1",
633
- voice=voice_option3,
634
- input=query3,
635
- )
636
-
637
- # Stream or save the response as needed
638
- # For demonstration, let's assume we save then provide a link for downloading
639
- audio_file_path = "output.mp3"
640
- response.stream_to_file(audio_file_path)
 
 
 
 
 
 
 
 
 
 
 
641
 
642
- # Display audio file to download
643
- st.audio(audio_file_path, format='audio/mp3')
644
- st.success("Conversion successful!")
645
-
646
- except Exception as e:
647
- st.error(f"An error occurred: {e}")
648
- else:
649
- st.error("Please enter some text to convert.")
650
 
 
 
 
 
651
 
652
 
653
  with tab4:
 
613
  # Display the graph
614
  agraph(nodes=graph_store.getNodes(), edges=graph_store.getEdges(), config=agraph_config)
615
 
 
 
616
 
617
+ col3, col4 = st.columns(2)
618
+ with col3:
619
+
620
+ st.markdown(query3)
 
 
 
 
621
 
622
+ # Displaying the audio player below the text
623
+ voice_option3 = st.selectbox(
624
+ 'Choose a voice:',
625
+ ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'],key='key5'
626
+ )
627
+
628
+
629
+ if st.button('Convert to Speech', key='key6'):
630
+ if query2:
631
+ try:
632
+ response = oai_client.audio.speech.create(
633
+ model="tts-1",
634
+ voice=voice_option3,
635
+ input=query3,
636
+ )
637
+
638
+ # Stream or save the response as needed
639
+ # For demonstration, let's assume we save then provide a link for downloading
640
+ audio_file_path = "output.mp3"
641
+ response.stream_to_file(audio_file_path)
642
+
643
+ # Display audio file to download
644
+ st.audio(audio_file_path, format='audio/mp3')
645
+ st.success("Conversion successful!")
646
 
647
+ except Exception as e:
648
+ st.error(f"An error occurred: {e}")
649
+ else:
650
+ st.error("Please enter some text to convert.")
651
+
652
+ with col4:
 
 
653
 
654
+ image = Image.open('./data/incentive_image.jpg')
655
+ st.image(image, caption='Sensor Insentive Program')
656
+
657
+
658
 
659
 
660
  with tab4: