Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -438,16 +438,16 @@ class RefinementLoop:
|
|
438 |
|
439 |
def __init__(self, pipeline: DevelopmentPipeline, max_iterations: int = 100):
|
440 |
self.pipeline = pipeline
|
441 |
-
self.max_iterations = max_iterations #
|
442 |
-
self.current_iteration = 0 #
|
443 |
-
self.refinement_history: List[Dict[str, Any]] = [] #
|
444 |
-
self.quality_metrics = QualityMetrics() #
|
445 |
-
self.error_tracker = ErrorTracker() #
|
446 |
-
self.improvement_suggestions: List[str] = [] #
|
447 |
-
self.state = self.RefinementState.INITIALIZING #
|
448 |
-
self.logger = self._setup_logger() #
|
449 |
-
self.performance_monitor = self._setup_performance_monitor() #
|
450 |
-
self.refinement_strategies = self._initialize_refinement_strategies() #
|
451 |
|
452 |
def _setup_logger(self) -> logging.Logger:
|
453 |
"""Set up enhanced logging with detailed formatting"""
|
@@ -559,7 +559,7 @@ class RefinementLoop:
|
|
559 |
}
|
560 |
finally:
|
561 |
self.performance_monitor["end_time"] = time.time()
|
562 |
-
|
563 |
def _setup_performance_monitor(self):
|
564 |
"""Initialize performance monitoring"""
|
565 |
return {
|
@@ -1094,7 +1094,6 @@ class AutonomousAgent:
|
|
1094 |
def {requirement.replace(' ', '_')}():
|
1095 |
print("Executing {requirement}...")
|
1096 |
# Add your implementation here
|
1097 |
-
|
1098 |
if __name__ == "__main__":
|
1099 |
{requirement.replace(' ', '_')}()
|
1100 |
"""
|
@@ -1158,8 +1157,9 @@ class AutonomousAgentApp:
|
|
1158 |
|
1159 |
def __init__(self):
|
1160 |
self.workspace_manager = WorkspaceManager(workspace_dir='workspace')
|
1161 |
-
self.
|
1162 |
-
self.
|
|
|
1163 |
|
1164 |
def _initialize_pipeline(self) -> DevelopmentPipeline:
|
1165 |
"""Initialize the development pipeline"""
|
@@ -1176,7 +1176,7 @@ class AutonomousAgentApp:
|
|
1176 |
"""Main application entry point"""
|
1177 |
try:
|
1178 |
logger.info("Starting Autonomous Agent Application")
|
1179 |
-
self.interface.render_main_interface()
|
1180 |
except Exception as e:
|
1181 |
logger.error(f"Application error: {str(e)}")
|
1182 |
st.error("An error occurred while starting the application. Please check the logs.")
|
@@ -1609,7 +1609,7 @@ class StreamlitInterface:
|
|
1609 |
if task:
|
1610 |
# Run the autonomous agent with the provided task
|
1611 |
try:
|
1612 |
-
result = asyncio.run(self.app.
|
1613 |
st.success(f"Result: {result}")
|
1614 |
except Exception as e:
|
1615 |
st.error(f"An error occurred: {str(e)}")
|
@@ -1776,7 +1776,7 @@ class StreamlitInterface:
|
|
1776 |
st.write(f"Python Version: {sys.version}")
|
1777 |
st.write(f"Platform: {platform.platform()}")
|
1778 |
st.write(f"Available Memory: {psutil.virtual_memory().available / (1024**3):.1f} GB free")
|
1779 |
-
|
1780 |
def main():
|
1781 |
app = AutonomousAgentApp()
|
1782 |
app.run()
|
|
|
438 |
|
439 |
def __init__(self, pipeline: DevelopmentPipeline, max_iterations: int = 100):
|
440 |
self.pipeline = pipeline
|
441 |
+
self.max_iterations = max_iterations # Maximum number of refinement iterations
|
442 |
+
self.current_iteration = 0 # Current iteration counter
|
443 |
+
self.refinement_history: List[Dict[str, Any]] = [] # History of refinement cycles
|
444 |
+
self.quality_metrics = QualityMetrics() # Quality metrics tracker
|
445 |
+
self.error_tracker = ErrorTracker() # Error tracking and analysis
|
446 |
+
self.improvement_suggestions: List[str] = [] # Suggestions for improvement
|
447 |
+
self.state = self.RefinementState.INITIALIZING # Current state of the refinement loop
|
448 |
+
self.logger = self._setup_logger() # Logger for debugging and monitoring
|
449 |
+
self.performance_monitor = self._setup_performance_monitor() # Performance tracking
|
450 |
+
self.refinement_strategies = self._initialize_refinement_strategies() # Strategies for refinement
|
451 |
|
452 |
def _setup_logger(self) -> logging.Logger:
|
453 |
"""Set up enhanced logging with detailed formatting"""
|
|
|
559 |
}
|
560 |
finally:
|
561 |
self.performance_monitor["end_time"] = time.time()
|
562 |
+
|
563 |
def _setup_performance_monitor(self):
|
564 |
"""Initialize performance monitoring"""
|
565 |
return {
|
|
|
1094 |
def {requirement.replace(' ', '_')}():
|
1095 |
print("Executing {requirement}...")
|
1096 |
# Add your implementation here
|
|
|
1097 |
if __name__ == "__main__":
|
1098 |
{requirement.replace(' ', '_')}()
|
1099 |
"""
|
|
|
1157 |
|
1158 |
def __init__(self):
|
1159 |
self.workspace_manager = WorkspaceManager(workspace_dir='workspace')
|
1160 |
+
self.pipeline = self._initialize_pipeline()
|
1161 |
+
self.refinement_loop = RefinementLoop(pipeline=self.pipeline)
|
1162 |
+
self.interface = StreamlitInterface(self) # Corrected: Pass the app instance
|
1163 |
|
1164 |
def _initialize_pipeline(self) -> DevelopmentPipeline:
|
1165 |
"""Initialize the development pipeline"""
|
|
|
1176 |
"""Main application entry point"""
|
1177 |
try:
|
1178 |
logger.info("Starting Autonomous Agent Application")
|
1179 |
+
self.interface.render_main_interface()
|
1180 |
except Exception as e:
|
1181 |
logger.error(f"Application error: {str(e)}")
|
1182 |
st.error("An error occurred while starting the application. Please check the logs.")
|
|
|
1609 |
if task:
|
1610 |
# Run the autonomous agent with the provided task
|
1611 |
try:
|
1612 |
+
result = asyncio.run(self.app.refinement_loop.run_refinement_cycle(task))
|
1613 |
st.success(f"Result: {result}")
|
1614 |
except Exception as e:
|
1615 |
st.error(f"An error occurred: {str(e)}")
|
|
|
1776 |
st.write(f"Python Version: {sys.version}")
|
1777 |
st.write(f"Platform: {platform.platform()}")
|
1778 |
st.write(f"Available Memory: {psutil.virtual_memory().available / (1024**3):.1f} GB free")
|
1779 |
+
|
1780 |
def main():
|
1781 |
app = AutonomousAgentApp()
|
1782 |
app.run()
|