Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -142,6 +142,36 @@ def copy_to_clipboard_js(text, button_id):
|
|
| 142 |
<span id="copy_status_{button_id}" style="margin-left: 10px; font-weight: bold;"></span>
|
| 143 |
"""
|
| 144 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 145 |
# --- Streamlit App ---
|
| 146 |
st.set_page_config(layout="wide", page_title="Smart Context Citation Tool")
|
| 147 |
|
|
@@ -218,18 +248,15 @@ with tabs[0]:
|
|
| 218 |
with col6:
|
| 219 |
annotated_text = st.text_input("Annotated Text", help="The text quoted or paraphrased from the source", placeholder="e.g., Thermal comfort thresholds...")
|
| 220 |
|
| 221 |
-
#
|
|
|
|
|
|
|
|
|
|
| 222 |
melbourne_tz = pytz.timezone(MELBOURNE_TIMEZONE)
|
| 223 |
current_datetime_melbourne = datetime.now(melbourne_tz)
|
| 224 |
current_date = current_datetime_melbourne.strftime("%Y-%m-%d")
|
| 225 |
current_time = current_datetime_melbourne.strftime("%H:%M:%S")
|
| 226 |
|
| 227 |
-
st.markdown(f"""
|
| 228 |
-
<div class="datetime-display">
|
| 229 |
-
{current_date} {current_time}
|
| 230 |
-
</div>
|
| 231 |
-
""", unsafe_allow_html=True)
|
| 232 |
-
|
| 233 |
generate_button = st.button("Generate Citation", type="primary", use_container_width=True)
|
| 234 |
|
| 235 |
if generate_button:
|
|
|
|
| 142 |
<span id="copy_status_{button_id}" style="margin-left: 10px; font-weight: bold;"></span>
|
| 143 |
"""
|
| 144 |
|
| 145 |
+
# --- Live Clock JavaScript ---
|
| 146 |
+
def live_clock():
|
| 147 |
+
return """
|
| 148 |
+
<div class="datetime-display">
|
| 149 |
+
<span id="live_datetime"></span>
|
| 150 |
+
</div>
|
| 151 |
+
<script>
|
| 152 |
+
function updateClock() {
|
| 153 |
+
const options = {
|
| 154 |
+
timeZone: 'Australia/Melbourne',
|
| 155 |
+
year: 'numeric',
|
| 156 |
+
month: 'numeric',
|
| 157 |
+
day: 'numeric',
|
| 158 |
+
hour: '2-digit',
|
| 159 |
+
minute: '2-digit',
|
| 160 |
+
second: '2-digit',
|
| 161 |
+
hour12: false
|
| 162 |
+
};
|
| 163 |
+
const formatter = new Intl.DateTimeFormat('en-AU', options);
|
| 164 |
+
const now = new Date();
|
| 165 |
+
const parts = formatter.formatToParts(now);
|
| 166 |
+
const date = `${parts[4].value}-${parts[2].value}-${parts[0].value}`;
|
| 167 |
+
const time = `${parts[6].value}:${parts[8].value}:${parts[10].value}`;
|
| 168 |
+
document.getElementById('live_datetime').innerText = `${date} ${time}`;
|
| 169 |
+
}
|
| 170 |
+
updateClock();
|
| 171 |
+
setInterval(updateClock, 1000);
|
| 172 |
+
</script>
|
| 173 |
+
"""
|
| 174 |
+
|
| 175 |
# --- Streamlit App ---
|
| 176 |
st.set_page_config(layout="wide", page_title="Smart Context Citation Tool")
|
| 177 |
|
|
|
|
| 248 |
with col6:
|
| 249 |
annotated_text = st.text_input("Annotated Text", help="The text quoted or paraphrased from the source", placeholder="e.g., Thermal comfort thresholds...")
|
| 250 |
|
| 251 |
+
# Live date and time display
|
| 252 |
+
st.markdown(live_clock(), unsafe_allow_html=True)
|
| 253 |
+
|
| 254 |
+
# Get current date and time in Melbourne timezone for hash generation
|
| 255 |
melbourne_tz = pytz.timezone(MELBOURNE_TIMEZONE)
|
| 256 |
current_datetime_melbourne = datetime.now(melbourne_tz)
|
| 257 |
current_date = current_datetime_melbourne.strftime("%Y-%m-%d")
|
| 258 |
current_time = current_datetime_melbourne.strftime("%H:%M:%S")
|
| 259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 260 |
generate_button = st.button("Generate Citation", type="primary", use_container_width=True)
|
| 261 |
|
| 262 |
if generate_button:
|