one-pager-generator / test_app.py
phxdev's picture
Upload folder using huggingface_hub
51d8aa9 verified
#!/usr/bin/env python3
"""
Simple test script to verify the one-pager generator functionality
"""
import sys
import os
# Add the current directory to the path so we can import our app
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
def test_basic_functionality():
"""Test basic app functionality without launching the full interface"""
try:
from app import generate_onepager, initialize_model
print("πŸ§ͺ Testing One-Pager Generator...")
print("Initializing model...")
# Initialize the model
init_result = initialize_model()
print(f"Model initialization: {init_result}")
# Test generation with sample data
print("\nπŸ“ Testing one-pager generation...")
test_topic = "Artificial Intelligence in Healthcare"
test_audience = "Healthcare professionals"
test_keypoints = "Machine learning applications, Data privacy concerns, Cost-effectiveness, Implementation challenges"
test_tone = "Professional"
test_length = "Medium"
result = generate_onepager(
topic=test_topic,
target_audience=test_audience,
key_points=test_keypoints,
tone=test_tone,
length=test_length
)
print("Generated One-Pager:")
print("-" * 50)
print(result)
print("-" * 50)
if "Error" not in result:
print("βœ… Test passed! One-pager generated successfully.")
else:
print("❌ Test failed! Error in generation.")
except Exception as e:
print(f"❌ Test failed with exception: {str(e)}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
test_basic_functionality()