Spaces:
Running
Running
fixed the debug
Browse files
features/nepali_text_classifier/preprocess.py
CHANGED
|
@@ -19,7 +19,6 @@ def parse_pdf(file: BytesIO):
|
|
| 19 |
text = ""
|
| 20 |
for page in doc.pages:
|
| 21 |
text += page.extract_text()
|
| 22 |
-
# print(text)
|
| 23 |
return text
|
| 24 |
except Exception as e:
|
| 25 |
logging.error(f"Error while processing PDF: {str(e)}")
|
|
|
|
| 19 |
text = ""
|
| 20 |
for page in doc.pages:
|
| 21 |
text += page.extract_text()
|
|
|
|
| 22 |
return text
|
| 23 |
except Exception as e:
|
| 24 |
logging.error(f"Error while processing PDF: {str(e)}")
|
features/text_classifier/controller.py
CHANGED
|
@@ -65,7 +65,7 @@ async def handle_file_upload(file: UploadFile):
|
|
| 65 |
cleaned_text = file_contents.replace("\n", " ").replace("\t", " ").strip()
|
| 66 |
if not cleaned_text:
|
| 67 |
raise HTTPException(status_code=404, detail="The file is empty or only contains whitespace.")
|
| 68 |
-
print(f"Cleaned text: '{cleaned_text}'") # Debugging statement
|
| 69 |
label, perplexity, ai_likelihood = await asyncio.to_thread(classify_text, cleaned_text)
|
| 70 |
return {
|
| 71 |
"content": file_contents,
|
|
|
|
| 65 |
cleaned_text = file_contents.replace("\n", " ").replace("\t", " ").strip()
|
| 66 |
if not cleaned_text:
|
| 67 |
raise HTTPException(status_code=404, detail="The file is empty or only contains whitespace.")
|
| 68 |
+
# print(f"Cleaned text: '{cleaned_text}'") # Debugging statement
|
| 69 |
label, perplexity, ai_likelihood = await asyncio.to_thread(classify_text, cleaned_text)
|
| 70 |
return {
|
| 71 |
"content": file_contents,
|
features/text_classifier/preprocess.py
CHANGED
|
@@ -19,7 +19,6 @@ def parse_pdf(file: BytesIO):
|
|
| 19 |
text = ""
|
| 20 |
for page in doc.pages:
|
| 21 |
text += page.extract_text()
|
| 22 |
-
# print(text)
|
| 23 |
return text
|
| 24 |
except Exception as e:
|
| 25 |
logging.error(f"Error while processing PDF: {str(e)}")
|
|
|
|
| 19 |
text = ""
|
| 20 |
for page in doc.pages:
|
| 21 |
text += page.extract_text()
|
|
|
|
| 22 |
return text
|
| 23 |
except Exception as e:
|
| 24 |
logging.error(f"Error while processing PDF: {str(e)}")
|