Spaces:
Build error
Build error
File size: 2,097 Bytes
97b46ba e6c084b 97b46ba b97c89b 586aa2c 640e776 586aa2c 97b46ba 586aa2c 3c9d57d dfc00ea 3c9d57d 97b46ba 17892c0 b97c89b 148ad1e 89a666f 148ad1e e3c41e6 148ad1e e3c41e6 148ad1e 17fa943 53fb305 e3c41e6 97b46ba | 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 | import sys
import os
import traceback
import json
import logging
import gradio as gr
sys.path.append(os.path.abspath('common'))
sys.path.append(os.path.abspath('researchsimulation'))
from crewai import Crew, Task, Process
from RespondentAgent import *
from LLMConfig import *
from PanelInterface import *
# Configure logging
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
# MAIN
if __name__ == "__main__":
logging.info("Loading environment...")
Config.load_environment(".", "invictus.dev1")
logging.info("Environment loaded. Printing environment:")
Config.print_environment()
logging.info("Initializing processor_llm...")
processor_llm = get_processor_llm_instance()
logging.info("processor_llm initialized.")
logging.info("Initializing respondent_agent_llm...")
respondent_agent_llm = get_respondent_agent_llm_instance()
logging.info("respondent_agent_llm initialised.")
# Load all user profiles from the Excel file
data_dictionary = DataDictionary.generate_dictionary(Config.data_dictionary_file)
logging.info(f"Generated data dictionary: {data_dictionary}")
personality_assessment = PVAssessment.generate_personality_assessment(Config.personality_question_file)
logging.info(f"Generated personality_assessment: {data_dictionary}")
respondent_agent_user_profiles = UserProfile.read_user_profiles_from_excel(Config.respondent_details_file, data_dictionary, personality_assessment)
# Create respondent agents for all profiles
respondent_agents_dict = {
profile.get_field("Demographics", "Name"): RespondentAgent.create(
profile, f"{Config.config_dir}/fastfacts/{profile.ID}_fast_facts.xlsx", respondent_agent_llm
)
for profile in respondent_agent_user_profiles[:5]
}
logging.info(f"Total agents created: {len(respondent_agents_dict)}")
demo = build_interface(respondent_agents_dict, processor_llm)
logging.info("Launching Gradio interface...")
demo.launch(debug=True) |