Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -7,9 +7,7 @@ import torch
|
|
7 |
from gtts import gTTS
|
8 |
import io
|
9 |
import time
|
10 |
-
from streamlit.components.v1 import html
|
11 |
import asyncio
|
12 |
-
import base64
|
13 |
|
14 |
if not asyncio.get_event_loop().is_running():
|
15 |
asyncio.set_event_loop(asyncio.new_event_loop())
|
@@ -77,7 +75,7 @@ results_container = st.container()
|
|
77 |
# JavaScript timer component with stop function
|
78 |
def create_timer():
|
79 |
return """
|
80 |
-
<div
|
81 |
<div id="timer" style="font-size:16px;color:#666;margin-bottom:10px;">⏱️ Elapsed: 00:00</div>
|
82 |
</div>
|
83 |
<script>
|
@@ -114,6 +112,7 @@ def create_timer():
|
|
114 |
|
115 |
def stop_timer():
|
116 |
return """
|
|
|
117 |
<script>
|
118 |
if (window.currentTimerID && window[window.currentTimerID]) {
|
119 |
clearInterval(window[window.currentTimerID]);
|
@@ -152,8 +151,8 @@ if uploaded_file is not None:
|
|
152 |
st.session_state.current_file = uploaded_file.name
|
153 |
st.session_state.timer_active = True
|
154 |
|
155 |
-
# Display timer
|
156 |
-
timer_container.html(create_timer()
|
157 |
|
158 |
# Progress indicators
|
159 |
status_text = status_container.empty()
|
@@ -189,8 +188,8 @@ if uploaded_file is not None:
|
|
189 |
# Final status
|
190 |
status_text.success("**✅ Generation complete!**")
|
191 |
|
192 |
-
# Stop timer
|
193 |
-
timer_container.html(stop_timer()
|
194 |
|
195 |
# Show results
|
196 |
with results_container:
|
@@ -198,7 +197,7 @@ if uploaded_file is not None:
|
|
198 |
st.write("**Story:**", st.session_state.processed_data['story'])
|
199 |
|
200 |
except Exception as e:
|
201 |
-
timer_container.html(stop_timer()
|
202 |
status_text.error(f"**❌ Error:** {str(e)}")
|
203 |
progress_bar.empty()
|
204 |
raise e
|
|
|
7 |
from gtts import gTTS
|
8 |
import io
|
9 |
import time
|
|
|
10 |
import asyncio
|
|
|
11 |
|
12 |
if not asyncio.get_event_loop().is_running():
|
13 |
asyncio.set_event_loop(asyncio.new_event_loop())
|
|
|
75 |
# JavaScript timer component with stop function
|
76 |
def create_timer():
|
77 |
return """
|
78 |
+
<div style="height:60px;">
|
79 |
<div id="timer" style="font-size:16px;color:#666;margin-bottom:10px;">⏱️ Elapsed: 00:00</div>
|
80 |
</div>
|
81 |
<script>
|
|
|
112 |
|
113 |
def stop_timer():
|
114 |
return """
|
115 |
+
<div style="height:0px;"></div>
|
116 |
<script>
|
117 |
if (window.currentTimerID && window[window.currentTimerID]) {
|
118 |
clearInterval(window[window.currentTimerID]);
|
|
|
151 |
st.session_state.current_file = uploaded_file.name
|
152 |
st.session_state.timer_active = True
|
153 |
|
154 |
+
# Display timer (removed height parameter)
|
155 |
+
timer_container.html(create_timer())
|
156 |
|
157 |
# Progress indicators
|
158 |
status_text = status_container.empty()
|
|
|
188 |
# Final status
|
189 |
status_text.success("**✅ Generation complete!**")
|
190 |
|
191 |
+
# Stop timer (removed height parameter)
|
192 |
+
timer_container.html(stop_timer())
|
193 |
|
194 |
# Show results
|
195 |
with results_container:
|
|
|
197 |
st.write("**Story:**", st.session_state.processed_data['story'])
|
198 |
|
199 |
except Exception as e:
|
200 |
+
timer_container.html(stop_timer())
|
201 |
status_text.error(f"**❌ Error:** {str(e)}")
|
202 |
progress_bar.empty()
|
203 |
raise e
|