Spaces:
Running
Running
from models import initialize_models | |
from models.pdf_handler import parse_pdf | |
from models.image_handler import analyze_image | |
from models.summarizer import summarize_text | |
from models.translator import translate_text | |
from models.problem_checker import flag_lab_problems | |
def main(): | |
# Initialize Hugging Face models | |
models = initialize_models() | |
# Example 1: Parse and summarize a PDF lab report | |
pdf_path = "example_lab_report.pdf" | |
pdf_text = parse_pdf(pdf_path) | |
print("Extracted Text from PDF:\n", pdf_text) | |
summary = summarize_text(pdf_text, models["summarize_model"]) | |
print("\nSummary:\n", summary) | |
# Check for problems in the lab report | |
problems = flag_lab_problems(summary) | |
print("\nDetected Problems:\n", problems) | |
# Example 2: Translate the summary if needed | |
translated_summary = translate_text(summary, models["translation_model"]) | |
print("\nTranslated Summary:\n", translated_summary) | |
# Example 3: Analyze an image | |
image_path = "example_lab_image.jpg" | |
image_results = analyze_image(image_path, models["image_model"]) | |
print("\nImage Analysis Results:\n", image_results) | |
if __name__ == "__main__": | |
main() | |