nguyenit67 commited on
Commit
1f1b0d7
·
1 Parent(s): a53041c

Add presentation file pdf

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. .gitignore +0 -1
  3. FinalProject-Presentation.pdf +3 -0
  4. app.py +6 -9
.gitattributes CHANGED
@@ -1 +1,2 @@
1
  *.doc filter=lfs diff=lfs merge=lfs -text
 
 
1
  *.doc filter=lfs diff=lfs merge=lfs -text
2
+ *.pdf filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -10,7 +10,6 @@ __pycache__/
10
  # Binary files
11
  .doc
12
  .docx
13
- .pdf
14
 
15
  # Distribution / packaging
16
  .Python
 
10
  # Binary files
11
  .doc
12
  .docx
 
13
 
14
  # Distribution / packaging
15
  .Python
FinalProject-Presentation.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2cffe218897cc50ac518baa9c74320c52b4956f34143e6601a4d119638bfba2d
3
+ size 751258
app.py CHANGED
@@ -135,9 +135,6 @@ def load_data_protection_rules():
135
  def extract_text_from_file(uploaded_file):
136
  """Extract text from uploaded file (PDF, MARKDOWN, DOC/DOCX, or TXT)"""
137
  try:
138
- st.write(f"Processing file: {uploaded_file.name}")
139
- st.write(f"File type: {type(uploaded_file)}")
140
-
141
  # Reset file pointer to beginning
142
  uploaded_file.seek(0)
143
 
@@ -310,8 +307,8 @@ def chat_with_document(client, prefix: str, question: str) -> str:
310
 
311
  # Main app
312
  def main():
313
- st.title("📄 Document Analysis Chatbot with Implicit Caching")
314
- # st.markdown("*Powered by Gemini 2.5 Flash with Automatic Cost Optimization*")
315
  # st.markdown("---")
316
 
317
  # Load data protection rules automatically on startup
@@ -336,7 +333,7 @@ def main():
336
  **Cách 2:** Nhập trực tiếp ở sidebar
337
 
338
  ### 📝 Lấy API Key:
339
- 1. Truy cập [Google AI Studio](https://makersuite.google.com/app/apikey)
340
  2. Tạo API Key mới
341
  3. Sao chép và cấu hình
342
  """
@@ -347,8 +344,8 @@ def main():
347
  st.sidebar.header("📁 Upload Tài liệu")
348
  uploaded_file = st.sidebar.file_uploader(
349
  "Chọn tài liệu cần phân tích",
350
- type=["pdf", "doc", "txt", "md", "docx"],
351
- help="Hỗ trợ định dạng PDF, MARKDOWN, DOC/DOCX, TXT",
352
  )
353
 
354
  # Show data protection status
@@ -390,7 +387,7 @@ def main():
390
  # Create a container for chat messages
391
  prompt = st.chat_input("Đặt câu hỏi về tài liệu...")
392
 
393
- with st.container(height=500):
394
  # Display chat history
395
  for message in st.session_state.messages:
396
  with st.chat_message(message["role"]):
 
135
  def extract_text_from_file(uploaded_file):
136
  """Extract text from uploaded file (PDF, MARKDOWN, DOC/DOCX, or TXT)"""
137
  try:
 
 
 
138
  # Reset file pointer to beginning
139
  uploaded_file.seek(0)
140
 
 
307
 
308
  # Main app
309
  def main():
310
+ st.title("📄 Document Analysis Chatbot")
311
+ st.markdown("*Powered by Gemini 2.5 Flash with Automatic Cost Optimization*")
312
  # st.markdown("---")
313
 
314
  # Load data protection rules automatically on startup
 
333
  **Cách 2:** Nhập trực tiếp ở sidebar
334
 
335
  ### 📝 Lấy API Key:
336
+ 1. Truy cập [Google AI Studio](https://aistudio.google.com/app/apikey)
337
  2. Tạo API Key mới
338
  3. Sao chép và cấu hình
339
  """
 
344
  st.sidebar.header("📁 Upload Tài liệu")
345
  uploaded_file = st.sidebar.file_uploader(
346
  "Chọn tài liệu cần phân tích",
347
+ type=["pdf", "doc", "docx", "md", "txt"],
348
+ help="Hỗ trợ định dạng PDF, DOC/DOCX, MARKDOWN, TXT",
349
  )
350
 
351
  # Show data protection status
 
387
  # Create a container for chat messages
388
  prompt = st.chat_input("Đặt câu hỏi về tài liệu...")
389
 
390
+ with st.container(height=350):
391
  # Display chat history
392
  for message in st.session_state.messages:
393
  with st.chat_message(message["role"]):