Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -182,7 +182,7 @@ with st.sidebar:
|
|
| 182 |
model_manager = load_model_manager()
|
| 183 |
|
| 184 |
# Nút tải model
|
| 185 |
-
load_clicked = st.button(f"📥 Tải mô hình {selected_model}"
|
| 186 |
if load_clicked:
|
| 187 |
with st.spinner(f"Đang tải {selected_model}..."):
|
| 188 |
# Gọi hàm load tương ứng với model được chọn
|
|
@@ -393,7 +393,7 @@ with st.sidebar:
|
|
| 393 |
st.subheader("💾 Quản lý bộ nhớ")
|
| 394 |
|
| 395 |
# Nút xóa cache và giải phóng bộ nhớ
|
| 396 |
-
if st.button("🗑️ Xóa cache và giải phóng bộ nhớ"
|
| 397 |
st.cache_resource.clear() # Xóa cache Streamlit
|
| 398 |
torch.cuda.empty_cache() # Giải phóng bộ nhớ GPU
|
| 399 |
st.success("Đã xóa cache và giải phóng bộ nhớ!")
|
|
@@ -515,7 +515,7 @@ if uploaded_image is not None:
|
|
| 515 |
# -----------------------------------------------------------------
|
| 516 |
# NÚT TẠO MÔ TẢ
|
| 517 |
# -----------------------------------------------------------------
|
| 518 |
-
if st.button("🚀 Tạo mô tả", type="primary"
|
| 519 |
with st.spinner("Đang tạo mô tả..."):
|
| 520 |
start_time = time.time() # Bắt đầu đo thời gian
|
| 521 |
|
|
@@ -571,7 +571,7 @@ if uploaded_image is not None:
|
|
| 571 |
if 'current_caption' in st.session_state and st.session_state['current_caption']:
|
| 572 |
st.divider()
|
| 573 |
|
| 574 |
-
if st.button("🇻🇳 Dịch sang tiếng Việt", type="secondary"
|
| 575 |
with st.spinner("Đang dịch..."):
|
| 576 |
try:
|
| 577 |
# Sử dụng Google Translator để dịch EN -> VI
|
|
|
|
| 182 |
model_manager = load_model_manager()
|
| 183 |
|
| 184 |
# Nút tải model
|
| 185 |
+
load_clicked = st.button(f"📥 Tải mô hình {selected_model}")
|
| 186 |
if load_clicked:
|
| 187 |
with st.spinner(f"Đang tải {selected_model}..."):
|
| 188 |
# Gọi hàm load tương ứng với model được chọn
|
|
|
|
| 393 |
st.subheader("💾 Quản lý bộ nhớ")
|
| 394 |
|
| 395 |
# Nút xóa cache và giải phóng bộ nhớ
|
| 396 |
+
if st.button("🗑️ Xóa cache và giải phóng bộ nhớ"):
|
| 397 |
st.cache_resource.clear() # Xóa cache Streamlit
|
| 398 |
torch.cuda.empty_cache() # Giải phóng bộ nhớ GPU
|
| 399 |
st.success("Đã xóa cache và giải phóng bộ nhớ!")
|
|
|
|
| 515 |
# -----------------------------------------------------------------
|
| 516 |
# NÚT TẠO MÔ TẢ
|
| 517 |
# -----------------------------------------------------------------
|
| 518 |
+
if st.button("🚀 Tạo mô tả", type="primary"):
|
| 519 |
with st.spinner("Đang tạo mô tả..."):
|
| 520 |
start_time = time.time() # Bắt đầu đo thời gian
|
| 521 |
|
|
|
|
| 571 |
if 'current_caption' in st.session_state and st.session_state['current_caption']:
|
| 572 |
st.divider()
|
| 573 |
|
| 574 |
+
if st.button("🇻🇳 Dịch sang tiếng Việt", type="secondary"):
|
| 575 |
with st.spinner("Đang dịch..."):
|
| 576 |
try:
|
| 577 |
# Sử dụng Google Translator để dịch EN -> VI
|