NEXAS commited on
Commit
0b2b94d
·
verified ·
1 Parent(s): 97b050d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -29
app.py CHANGED
@@ -183,33 +183,6 @@ def format_prompt_inputs(image_collection, text_collection, video_collection, us
183
 
184
  return inputs
185
 
186
- def unzip_file(zip_path, extract_to):
187
- """
188
- Unzips a zip file to the specified directory.
189
-
190
- Args:
191
- zip_path (str): Path to the zip file.
192
- extract_to (str): Directory where the contents should be extracted.
193
- """
194
- try:
195
- # Ensure the destination directory exists
196
- os.makedirs(extract_to, exist_ok=True)
197
-
198
- # Open the zip file
199
- with zipfile.ZipFile(zip_path, 'r') as zip_ref:
200
- # Extract all the contents
201
- zip_ref.extractall(extract_to)
202
- return True
203
- except Exception as e:
204
- print(f"An error occurred: {e}")
205
- return False
206
-
207
- def process_pdf(pdf_path):
208
- # Placeholder function to simulate PDF processing
209
- # Replace this with actual PDF processing logic, such as extracting text, images, etc.
210
- time.sleep(2) # Simulating processing delay
211
- return "image_collection", "text_collection", "video_collection" # Replace with actual collections
212
-
213
  def page_1():
214
  st.title("Page 1: Upload and Process PDFs")
215
 
@@ -229,7 +202,6 @@ def page_1():
229
  try:
230
  total_files = len(uploaded_pdf_files)
231
  files_processed = 0
232
- progress_step = 100 / total_files if total_files > 0 else 0
233
 
234
  # Process PDF files
235
  for uploaded_pdf in uploaded_pdf_files:
@@ -239,7 +211,7 @@ def page_1():
239
 
240
  # Simulate PDF processing (replace with actual PDF processing logic)
241
  files_processed += 1
242
- progress_bar.progress(files_processed * progress_step)
243
  status_text.text(f"Processing PDF: {uploaded_pdf.name} ({files_processed}/{total_files})")
244
 
245
  # Call your actual PDF processing function here
 
183
 
184
  return inputs
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  def page_1():
187
  st.title("Page 1: Upload and Process PDFs")
188
 
 
202
  try:
203
  total_files = len(uploaded_pdf_files)
204
  files_processed = 0
 
205
 
206
  # Process PDF files
207
  for uploaded_pdf in uploaded_pdf_files:
 
211
 
212
  # Simulate PDF processing (replace with actual PDF processing logic)
213
  files_processed += 1
214
+ progress_bar.progress(files_processed / total_files) # Updated progress calculation
215
  status_text.text(f"Processing PDF: {uploaded_pdf.name} ({files_processed}/{total_files})")
216
 
217
  # Call your actual PDF processing function here