Spaces:
Running
Running
add time
Browse files- pages/upload.py +6 -1
pages/upload.py
CHANGED
@@ -1,12 +1,13 @@
|
|
1 |
import streamlit as st
|
2 |
import google.generativeai as genai
|
3 |
-
from db.mongodb import
|
4 |
from powerpoint.pptx import translate_pptx
|
5 |
from excel.xlsx import translate_xlsx
|
6 |
from excel.excel_translate import translate_csv
|
7 |
from word.word_helper import translate_docx
|
8 |
import dotenv
|
9 |
import os
|
|
|
10 |
|
11 |
dotenv.load_dotenv(".env")
|
12 |
genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
|
@@ -111,6 +112,10 @@ def process_file(file, file_type):
|
|
111 |
|
112 |
# Nút xử lý
|
113 |
if uploaded_file and st.button("🚀 Upload và dịch ngay!"):
|
|
|
|
|
|
|
|
|
114 |
with st.spinner("🔎 Đang phát hiện loại file..."):
|
115 |
file_type = detect_file_type(uploaded_file)
|
116 |
st.write(f"🔍 **Loại file phát hiện:** `{file_type}`")
|
|
|
1 |
import streamlit as st
|
2 |
import google.generativeai as genai
|
3 |
+
from db.mongodb import detect_file_type
|
4 |
from powerpoint.pptx import translate_pptx
|
5 |
from excel.xlsx import translate_xlsx
|
6 |
from excel.excel_translate import translate_csv
|
7 |
from word.word_helper import translate_docx
|
8 |
import dotenv
|
9 |
import os
|
10 |
+
from datetime import datetime, timedelta
|
11 |
|
12 |
dotenv.load_dotenv(".env")
|
13 |
genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
|
|
|
112 |
|
113 |
# Nút xử lý
|
114 |
if uploaded_file and st.button("🚀 Upload và dịch ngay!"):
|
115 |
+
upload_time = datetime.now() + timedelta(hours=5)
|
116 |
+
print("=" * 100)
|
117 |
+
print(f"🕒 Thời gian upload: {upload_time.strftime('%Y-%m-%d %H:%M:%S')}")
|
118 |
+
st.write(f"🕒 **Thời gian upload (UTC+5):** `{upload_time.strftime('%Y-%m-%d %H:%M:%S')}`")
|
119 |
with st.spinner("🔎 Đang phát hiện loại file..."):
|
120 |
file_type = detect_file_type(uploaded_file)
|
121 |
st.write(f"🔍 **Loại file phát hiện:** `{file_type}`")
|