File size: 1,581 Bytes
36fcf07 |
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 |
import sys
import os
print("Starting test...")
# Test importing the modules
try:
import gradio as gr
import whisper
import random
import time
from utils import SocialGraphManager, SuggestionGenerator
print("All modules imported successfully")
except Exception as e:
print(f"Error importing modules: {e}")
sys.exit(1)
# Test loading the social graph
try:
social_graph = SocialGraphManager("social_graph.json")
print("Social graph loaded successfully")
except Exception as e:
print(f"Error loading social graph: {e}")
sys.exit(1)
# Test initializing the suggestion generator
try:
suggestion_generator = SuggestionGenerator("distilgpt2") # Use a simpler model for testing
print("Suggestion generator initialized successfully")
except Exception as e:
print(f"Error initializing suggestion generator: {e}")
sys.exit(1)
# Test getting people from the social graph
try:
people = social_graph.get_people_list()
print(f"Found {len(people)} people in the social graph")
if people:
print(f"First person: {people[0]['name']} ({people[0]['role']})")
except Exception as e:
print(f"Error getting people from social graph: {e}")
sys.exit(1)
# Test getting person context
try:
if people:
person_id = people[0]['id']
person_context = social_graph.get_person_context(person_id)
print(f"Got context for {person_context.get('name', 'unknown')}")
except Exception as e:
print(f"Error getting person context: {e}")
sys.exit(1)
print("All tests passed successfully!")
|