Spaces:
Running
Running
Commit
·
674f46b
1
Parent(s):
02ef3dd
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,13 +24,30 @@ def extract_abstract(pdf_bytes):
|
|
| 24 |
|
| 25 |
# Function to process text (summarize and convert to speech)
|
| 26 |
def process_text(uploaded_file):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
# Extract the file data (byte content) from the uploaded file
|
| 28 |
# Check if 'content' key exists, and use it to access the file's byte content
|
| 29 |
-
if "content" in uploaded_file:
|
| 30 |
-
pdf_bytes = uploaded_file["data"]
|
| 31 |
-
else:
|
| 32 |
-
return "File content could not be retrieved", None
|
| 33 |
|
|
|
|
|
|
|
| 34 |
abstract_text = extract_abstract(pdf_bytes)
|
| 35 |
|
| 36 |
# Generate summary
|
|
|
|
| 24 |
|
| 25 |
# Function to process text (summarize and convert to speech)
|
| 26 |
def process_text(uploaded_file):
|
| 27 |
+
# Debugging: Check the type and content of the uploaded file
|
| 28 |
+
file_info = f"File type: {type(uploaded_file)}, File keys: {list(uploaded_file.keys())}"
|
| 29 |
+
|
| 30 |
+
# Check if 'data' key exists
|
| 31 |
+
if 'data' in uploaded_file:
|
| 32 |
+
file_info += f", Data type: {type(uploaded_file['data'])}, Data length: {len(uploaded_file['data'])}"
|
| 33 |
+
else:
|
| 34 |
+
file_info += ", 'data' key not found"
|
| 35 |
+
|
| 36 |
+
# For debugging, return the file info instead of processing the file
|
| 37 |
+
return file_info, "temp_output.wav"
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
# Function to process text (summarize and convert to speech)
|
| 41 |
+
#def process_text(uploaded_file):
|
| 42 |
# Extract the file data (byte content) from the uploaded file
|
| 43 |
# Check if 'content' key exists, and use it to access the file's byte content
|
| 44 |
+
# if "content" in uploaded_file:
|
| 45 |
+
# pdf_bytes = uploaded_file["data"]
|
| 46 |
+
# else:
|
| 47 |
+
# return "File content could not be retrieved", None
|
| 48 |
|
| 49 |
+
|
| 50 |
+
|
| 51 |
abstract_text = extract_abstract(pdf_bytes)
|
| 52 |
|
| 53 |
# Generate summary
|