Bentham commited on
Commit
b1c0fa5
·
verified ·
1 Parent(s): 4777466
Files changed (1) hide show
  1. main.py +10 -4
main.py CHANGED
@@ -779,14 +779,20 @@ async def convert_file_to_txt(
779
  raise HTTPException(status_code=500, detail="Erreur lors du nettoyage du fichier HTML.")
780
  input_filename = cleaned_input_filename
781
 
782
- # Conversion en HTML via pandoc si nécessaire
783
  if ext == '.pdf':
784
  html_content = pdf_to_html(input_filename)
785
  elif ext == '.pptx':
786
  html_content = convert_pptx_to_html(input_filename)
787
- elif ext in ['.ppt']:
788
- text = convert_ppt_to_text(input_filename)
789
- html_content = text_to_html(text)
 
 
 
 
 
 
790
  elif ext == '.doc':
791
  text = convert_doc_to_text(input_filename)
792
  html_content = text_to_html(text)
 
779
  raise HTTPException(status_code=500, detail="Erreur lors du nettoyage du fichier HTML.")
780
  input_filename = cleaned_input_filename
781
 
782
+ # Conversion en HTML via appropriate methods
783
  if ext == '.pdf':
784
  html_content = pdf_to_html(input_filename)
785
  elif ext == '.pptx':
786
  html_content = convert_pptx_to_html(input_filename)
787
+ elif ext == '.ppt':
788
+ try:
789
+ text = convert_doc_to_text(input_filename) # Reuse convert_doc_to_text which uses textract
790
+ html_content = text_to_html(text)
791
+ except HTTPException as e:
792
+ raise e
793
+ except Exception as e:
794
+ logging.error(f"Erreur lors de la conversion de .ppt avec textract: {e}")
795
+ raise HTTPException(status_code=500, detail=f"Erreur lors de la conversion du fichier .ppt: {e}")
796
  elif ext == '.doc':
797
  text = convert_doc_to_text(input_filename)
798
  html_content = text_to_html(text)