Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Test script for paper type classifier | |
| """ | |
| import sys | |
| import os | |
| sys.path.append(os.path.dirname(os.path.abspath(__file__))) | |
| from autoreview.paper_type_classifier import PaperTypeClassifier | |
| os.environ['OPENAI_API_KEY'] = 'sk-Aors1iVXAbgd7sGwC9Ff781c75D14b74A71d4e63F1E46b68' | |
| os.environ['OPENAI_BASEURL'] = 'https://api2.aigcbest.top/v1' | |
| def test_paper_classifier(): | |
| """Test the paper type classifier with sample content.""" | |
| # Sample paper contents for testing | |
| test_cases = [ | |
| { | |
| "content": "We propose a novel deep learning framework for natural language processing. Our approach introduces a new attention mechanism that significantly improves performance on benchmark datasets.", | |
| "expected": "Technical Paper" | |
| }, | |
| { | |
| "content": "This survey provides a comprehensive overview of recent advances in computer vision. We review over 100 papers published in the last five years and present a taxonomy of current approaches.", | |
| "expected": "Survey Paper" | |
| }, | |
| { | |
| "content": "We present a case study of deploying machine learning models in a real-world healthcare setting. Our application demonstrates the practical challenges and solutions for clinical decision support systems.", | |
| "expected": "Application Paper" | |
| }, | |
| { | |
| "content": "We introduce a new dataset of 10,000 annotated medical images for disease classification. The dataset includes detailed annotations and is publicly available for research purposes.", | |
| "expected": "Dataset Paper" | |
| }, | |
| { | |
| "content": "We release an open-source software tool for bioinformatics analysis. The tool provides a user-friendly interface and comprehensive documentation for researchers.", | |
| "expected": "Tool Paper" | |
| } | |
| ] | |
| classifier = PaperTypeClassifier() | |
| print("Testing Paper Type Classifier...") | |
| print("=" * 50) | |
| for i, test_case in enumerate(test_cases, 1): | |
| print(f"\nTest Case {i}:") | |
| print(f"Expected: {test_case['expected']}") | |
| # Test keyword-based classification | |
| keyword_result = classifier.classify_with_keywords(test_case['content']) | |
| print(f"Keyword-based: {keyword_result}") | |
| # Test LLM-based classification (if available) | |
| try: | |
| llm_result = classifier.classify_with_llm(test_case['content']) | |
| print(f"LLM-based: {llm_result}") | |
| except Exception as e: | |
| print(f"LLM-based: Error - {e}") | |
| print("-" * 30) | |
| if __name__ == "__main__": | |
| test_paper_classifier() | |