Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,63 +1,3 @@
|
|
| 1 |
-
# #!/usr/bin/env python
|
| 2 |
-
# import sys
|
| 3 |
-
# import os
|
| 4 |
-
# import warnings
|
| 5 |
-
# from crew import DocProcessing
|
| 6 |
-
|
| 7 |
-
# warnings.filterwarnings("ignore", category=SyntaxWarning, module="pysbd")
|
| 8 |
-
|
| 9 |
-
# def determine_file_type(file_path):
|
| 10 |
-
# """
|
| 11 |
-
# Determine the file type based on the file extension.
|
| 12 |
-
|
| 13 |
-
# Args:
|
| 14 |
-
# file_path (str): Path to the file
|
| 15 |
-
|
| 16 |
-
# Returns:
|
| 17 |
-
# str: 'pdf' if the file is a PDF, 'image' otherwise
|
| 18 |
-
# """
|
| 19 |
-
# _, ext = os.path.splitext(file_path)
|
| 20 |
-
# if ext.lower() == '.pdf':
|
| 21 |
-
# return 'pdf'
|
| 22 |
-
# return 'image'
|
| 23 |
-
|
| 24 |
-
# def run():
|
| 25 |
-
# """
|
| 26 |
-
# Run the crew with file paths received from command line arguments.
|
| 27 |
-
# """
|
| 28 |
-
# # Get file paths from command line arguments
|
| 29 |
-
# file_paths = sys.argv[1:] if len(sys.argv) > 1 else []
|
| 30 |
-
|
| 31 |
-
# if not file_paths:
|
| 32 |
-
# print("No file paths provided. Usage: python main.py <file_path1> <file_path2> ...")
|
| 33 |
-
# return
|
| 34 |
-
|
| 35 |
-
# # Process the first file (you can modify this to handle multiple files if needed)
|
| 36 |
-
# file_path = file_paths[0]
|
| 37 |
-
# file_type = determine_file_type(file_path)
|
| 38 |
-
|
| 39 |
-
# print(f"Processing file: {file_path} (type: {file_type})")
|
| 40 |
-
|
| 41 |
-
# # Prepare inputs for the CrewAI
|
| 42 |
-
# inputs = {
|
| 43 |
-
# "file_path": file_path,
|
| 44 |
-
# "file_type": file_type,
|
| 45 |
-
# }
|
| 46 |
-
|
| 47 |
-
# try:
|
| 48 |
-
# # Pass the inputs to the crew kickoff method
|
| 49 |
-
# result = DocProcessing().crew().kickoff(inputs=inputs)
|
| 50 |
-
# return result
|
| 51 |
-
# except Exception as e:
|
| 52 |
-
# error_msg = f"An error occurred while running the crew: {e}"
|
| 53 |
-
# print(error_msg)
|
| 54 |
-
# raise Exception(error_msg)
|
| 55 |
-
|
| 56 |
-
# if __name__ == "__main__":
|
| 57 |
-
# run()
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
#!/usr/bin/env python
|
| 62 |
import os
|
| 63 |
import tempfile
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
#!/usr/bin/env python
|
| 2 |
import os
|
| 3 |
import tempfile
|