Spaces:
Sleeping
Sleeping
change model version
Browse files- .env +1 -1
- pages/upload.py +2 -0
- test.ipynb +32 -0
- translate/__pycache__/translator.cpython-310.pyc +0 -0
- utils/__pycache__/utils.cpython-310.pyc +0 -0
- word/__pycache__/word_helper.cpython-310.pyc +0 -0
.env
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
GEMINI_API_KEY = AIzaSyDIPbH7zKoeTS5aKMQuMjzBBiVlWadcmr8
|
| 2 |
MONGODB_URI = mongodb+srv://admin:[email protected]/?retryWrites=true&w=majority&appName=Cluster0
|
| 3 |
-
MODEL_VERSION = gemini-2.
|
|
|
|
| 1 |
GEMINI_API_KEY = AIzaSyDIPbH7zKoeTS5aKMQuMjzBBiVlWadcmr8
|
| 2 |
MONGODB_URI = mongodb+srv://admin:[email protected]/?retryWrites=true&w=majority&appName=Cluster0
|
| 3 |
+
MODEL_VERSION = gemini-2.5-flash-lite-preview-06-17
|
pages/upload.py
CHANGED
|
@@ -106,6 +106,8 @@ def process_file(file, file_type):
|
|
| 106 |
st.success("🎉 File đã được dịch thành công!")
|
| 107 |
print(f"✅ File đã dịch: {output_name}")
|
| 108 |
st.download_button("⬇️ Tải file về", data=output_io.getvalue(), file_name=output_name)
|
|
|
|
|
|
|
| 109 |
else:
|
| 110 |
st.error("❌ Xảy ra lỗi khi xử lý file.")
|
| 111 |
|
|
|
|
| 106 |
st.success("🎉 File đã được dịch thành công!")
|
| 107 |
print(f"✅ File đã dịch: {output_name}")
|
| 108 |
st.download_button("⬇️ Tải file về", data=output_io.getvalue(), file_name=output_name)
|
| 109 |
+
end_time = datetime.now() + timedelta(hours=5)
|
| 110 |
+
print(f"🕒 Thời gian upload: {end_time.strftime('%Y-%m-%d %H:%M:%S')}")
|
| 111 |
else:
|
| 112 |
st.error("❌ Xảy ra lỗi khi xử lý file.")
|
| 113 |
|
test.ipynb
CHANGED
|
@@ -1,5 +1,37 @@
|
|
| 1 |
{
|
| 2 |
"cells": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
{
|
| 4 |
"cell_type": "code",
|
| 5 |
"execution_count": 1,
|
|
|
|
| 1 |
{
|
| 2 |
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "code",
|
| 5 |
+
"execution_count": 3,
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"outputs": [
|
| 8 |
+
{
|
| 9 |
+
"name": "stdout",
|
| 10 |
+
"output_type": "stream",
|
| 11 |
+
"text": [
|
| 12 |
+
"Được thôi, đây là một bài thơ haiku về lập trình Python:\n",
|
| 13 |
+
"\n",
|
| 14 |
+
"Cú pháp thật mềm,\n",
|
| 15 |
+
"Code chạy nhanh, không lỗi lầm.\n",
|
| 16 |
+
"Vui khi được code.\n",
|
| 17 |
+
"\n"
|
| 18 |
+
]
|
| 19 |
+
}
|
| 20 |
+
],
|
| 21 |
+
"source": [
|
| 22 |
+
"import google.generativeai as genai\n",
|
| 23 |
+
"from dotenv import load_dotenv\n",
|
| 24 |
+
"load_dotenv()\n",
|
| 25 |
+
"import os\n",
|
| 26 |
+
"\n",
|
| 27 |
+
"genai.configure(api_key=os.getenv(\"GEMINI_API_KEY\")) # Thay thế bằng khóa API của bạn\n",
|
| 28 |
+
"\n",
|
| 29 |
+
"model = genai.GenerativeModel(\"gemini-2.0-flash-lite\") # hoặc gemini-1.5-pro-latest\n",
|
| 30 |
+
"\n",
|
| 31 |
+
"response = model.generate_content(\"Viết một bài thơ haiku về lập trình Python.\")\n",
|
| 32 |
+
"print(response.text)\n"
|
| 33 |
+
]
|
| 34 |
+
},
|
| 35 |
{
|
| 36 |
"cell_type": "code",
|
| 37 |
"execution_count": 1,
|
translate/__pycache__/translator.cpython-310.pyc
CHANGED
|
Binary files a/translate/__pycache__/translator.cpython-310.pyc and b/translate/__pycache__/translator.cpython-310.pyc differ
|
|
|
utils/__pycache__/utils.cpython-310.pyc
CHANGED
|
Binary files a/utils/__pycache__/utils.cpython-310.pyc and b/utils/__pycache__/utils.cpython-310.pyc differ
|
|
|
word/__pycache__/word_helper.cpython-310.pyc
CHANGED
|
Binary files a/word/__pycache__/word_helper.cpython-310.pyc and b/word/__pycache__/word_helper.cpython-310.pyc differ
|
|
|