Spaces:
Runtime error
Runtime error
eaglelandsonce
commited on
Commit
•
bde9672
1
Parent(s):
d34c961
Update app.py
Browse files
app.py
CHANGED
@@ -299,6 +299,30 @@ accuracy and effectiveness.
|
|
299 |
|
300 |
"""
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
# Function to draw the grid with optional highlighting
|
303 |
|
304 |
def draw_grid(data, highlight_coords=None):
|
@@ -1117,12 +1141,50 @@ with tab4:
|
|
1117 |
|
1118 |
with tab5:
|
1119 |
st.header("Residential")
|
1120 |
-
|
1121 |
-
|
1122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1123 |
|
1124 |
-
|
1125 |
-
|
1126 |
-
|
1127 |
|
1128 |
|
|
|
299 |
|
300 |
"""
|
301 |
|
302 |
+
query5: """***End of the Day***
|
303 |
+
|
304 |
+
After an afternoon spent meticulously correcting sensors in Green Data City, Mohammad and Elian retreated to the residential quarters,
|
305 |
+
their camaraderie solidified over a day's hard work. As the sun set on the eco-friendly horizon, they shared a well-deserved meal,
|
306 |
+
their laughter mingling with plans for the future. This encounter marked the beginning of a fast friendship, with Elian looking
|
307 |
+
forward to learning from Mohammad, not only about the advanced technologies that made their city a marvel but also about the spirit
|
308 |
+
of innovation and teamwork that thrived within its boundaries. In the comfort of their newfound friendship, Elian felt a deep sense of
|
309 |
+
belonging and anticipation for the days ahead, ready to dive deeper into the wonders of Green Data City alongside his mentor and
|
310 |
+
friend.
|
311 |
+
|
312 |
+
Many thanks to our Team which made this project possible
|
313 |
+
|
314 |
+
Ahmad Talha Ansari
|
315 |
+
Nujaim Akeem
|
316 |
+
Reema Lemon (not connected)
|
317 |
+
Jaweria Batool
|
318 |
+
Muhammad Asad Ishfaq
|
319 |
+
|
320 |
+
Also thanks to Nasser Mooman who provide invaluable technical support for the project.
|
321 |
+
|
322 |
+
Michael Lively Team Leader
|
323 |
+
|
324 |
+
"""
|
325 |
+
|
326 |
# Function to draw the grid with optional highlighting
|
327 |
|
328 |
def draw_grid(data, highlight_coords=None):
|
|
|
1141 |
|
1142 |
with tab5:
|
1143 |
st.header("Residential")
|
1144 |
+
# Creating columns for the layout
|
1145 |
+
col1, col2 = st.columns([1, 2])
|
1146 |
|
1147 |
+
# Displaying the image in the left column
|
1148 |
+
with col1:
|
1149 |
+
image = Image.open('./data/resid_image.jpg')
|
1150 |
+
st.image(image, caption='Residential Living')
|
1151 |
+
|
1152 |
+
# Displaying the text above on the right
|
1153 |
+
with col2:
|
1154 |
+
|
1155 |
+
st.markdown(query4)
|
1156 |
+
|
1157 |
+
# Displaying the audio player below the text
|
1158 |
+
voice_option6 = st.selectbox(
|
1159 |
+
'Choose a voice:',
|
1160 |
+
['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'], key='key20'
|
1161 |
+
)
|
1162 |
+
|
1163 |
+
|
1164 |
+
if st.button('Convert to Speech', key='key11'):
|
1165 |
+
if query5:
|
1166 |
+
try:
|
1167 |
+
response = oai_client.audio.speech.create(
|
1168 |
+
model="tts-1",
|
1169 |
+
voice=voice_option6,
|
1170 |
+
input=query5,
|
1171 |
+
)
|
1172 |
+
|
1173 |
+
# Stream or save the response as needed
|
1174 |
+
# For demonstration, let's assume we save then provide a link for downloading
|
1175 |
+
audio_file_path = "output.mp3"
|
1176 |
+
response.stream_to_file(audio_file_path)
|
1177 |
+
|
1178 |
+
# Display audio file to download
|
1179 |
+
st.audio(audio_file_path, format='audio/mp3')
|
1180 |
+
st.success("Conversion successful!")
|
1181 |
+
|
1182 |
+
|
1183 |
+
except Exception as e:
|
1184 |
+
st.error(f"An error occurred: {e}")
|
1185 |
+
else:
|
1186 |
+
st.error("Please enter some text to convert.")
|
1187 |
|
1188 |
+
|
|
|
|
|
1189 |
|
1190 |
|