Spaces:
Sleeping
Sleeping
File size: 3,788 Bytes
db70c95 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | #!/usr/bin/env python3
"""
Test script to check if all dependencies can be imported for Hugging Face deployment
"""
import sys
def test_imports():
"""Test all required imports"""
print("π§ͺ Testing deployment readiness...")
failed_imports = []
# Test core dependencies
try:
import gradio
print("β
gradio")
except ImportError as e:
failed_imports.append(f"gradio: {e}")
print("β gradio")
try:
import groq
print("β
groq")
except ImportError as e:
failed_imports.append(f"groq: {e}")
print("β groq")
try:
import whisper
print("β
openai-whisper")
except ImportError as e:
failed_imports.append(f"openai-whisper: {e}")
print("β openai-whisper")
try:
import pydub
print("β
pydub")
except ImportError as e:
failed_imports.append(f"pydub: {e}")
print("β pydub")
try:
import soundfile
print("β
soundfile")
except ImportError as e:
failed_imports.append(f"soundfile: {e}")
print("β soundfile")
try:
import fitz # PyMuPDF
print("β
PyMuPDF")
except ImportError as e:
failed_imports.append(f"PyMuPDF: {e}")
print("β PyMuPDF")
try:
import docx
print("β
python-docx")
except ImportError as e:
failed_imports.append(f"python-docx: {e}")
print("β python-docx")
try:
import reportlab
print("β
reportlab")
except ImportError as e:
failed_imports.append(f"reportlab: {e}")
print("β reportlab")
try:
import speech_recognition
print("β
speechrecognition")
except ImportError as e:
failed_imports.append(f"speechrecognition: {e}")
print("β speechrecognition")
try:
import matplotlib
print("β
matplotlib")
except ImportError as e:
failed_imports.append(f"matplotlib: {e}")
print("β matplotlib")
try:
import numpy
print("β
numpy")
except ImportError as e:
failed_imports.append(f"numpy: {e}")
print("β numpy")
# Test module imports
print("\nπ¦ Testing custom modules...")
try:
import config
print("β
config")
except ImportError as e:
failed_imports.append(f"config: {e}")
print("β config")
try:
from modules.llm_handler import generate_coaching_question
print("β
modules.llm_handler")
except ImportError as e:
failed_imports.append(f"modules.llm_handler: {e}")
print("β modules.llm_handler")
try:
from modules.doc_processor import extract_text_from_document
print("β
modules.doc_processor")
except ImportError as e:
failed_imports.append(f"modules.doc_processor: {e}")
print("β modules.doc_processor")
try:
from modules.report_generator import generate_pdf_report
print("β
modules.report_generator")
except ImportError as e:
failed_imports.append(f"modules.report_generator: {e}")
print("β modules.report_generator")
# Summary
print("\n" + "="*50)
if failed_imports:
print(f"β {len(failed_imports)} import failures found:")
for failure in failed_imports:
print(f" - {failure}")
print("\nπ¨ App may not work properly on Hugging Face!")
return False
else:
print("β
All imports successful!")
print("π Ready for Hugging Face deployment!")
return True
if __name__ == "__main__":
success = test_imports()
sys.exit(0 if success else 1)
|