Spaces:
Runtime error
Runtime error
File size: 3,340 Bytes
c69ba8c |
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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
#!/usr/bin/env python3
"""
Quick AI Demo - Working SmoLagent without large model downloads
"""
import pandas as pd
from smolagents import CodeAgent, DuckDuckGoSearchTool
import warnings
warnings.filterwarnings('ignore')
def quick_demo():
"""Quick demo that works immediately"""
print("π QUICK AI DEMO - No Downloads Required")
print("=" * 50)
# Load the data first
csv_file_path = "C:/Users/Cosmo/Desktop/NTU Peak Singtel/outsystems_sample_logs_6months.csv"
try:
print("π Loading CSV data...")
df = pd.read_csv(csv_file_path)
print(f"β
Data loaded: {df.shape[0]} rows, {df.shape[1]} columns")
print(f"π Columns: {list(df.columns)}")
# Show basic analysis without AI first
print("\nπ BASIC DATA ANALYSIS:")
print("-" * 30)
# Error analysis
error_df = df[df['LogLevel'] == 'Error']
info_df = df[df['LogLevel'] == 'Info']
print(f"π¨ Total Error entries: {len(error_df)}")
print(f"βΉοΈ Total Info entries: {len(info_df)}")
print(f"π Error rate: {len(error_df)/len(df)*100:.1f}%")
# Top modules with errors
if not error_df.empty:
top_error_modules = error_df['Module'].value_counts().head(3)
print(f"\nπ Top 3 modules with errors:")
for module, count in top_error_modules.items():
print(f" β’ {module}: {count} errors")
# Check for missing data
missing_data = df.isnull().sum()
print(f"\nβ Missing data summary:")
for col, missing_count in missing_data.items():
if missing_count > 0:
print(f" β’ {col}: {missing_count} missing ({missing_count/len(df)*100:.1f}%)")
print("\n" + "=" * 50)
print("β
BASIC ANALYSIS COMPLETE!")
print("π‘ This shows your data is loading correctly.")
print("π€ AI features will work once model downloads complete.")
print("=" * 50)
return df
except Exception as e:
print(f"β Error loading data: {e}")
return None
def test_simple_agent():
"""Test if we can create an agent without heavy models"""
print("\nπ§ͺ Testing Simple Agent Creation...")
try:
# Just test the tools without a model first
search_tool = DuckDuckGoSearchTool()
print("β
DuckDuckGo search tool created successfully")
# Try to create agent (might fail without model, but we can catch it)
try:
agent = CodeAgent(tools=[search_tool])
print("β
Agent created (basic setup)")
except Exception as e:
print(f"βΉοΈ Agent needs model: {e}")
print("π‘ This is expected - agent will work once model is ready")
except Exception as e:
print(f"β Tool creation failed: {e}")
if __name__ == "__main__":
# Run the quick demo
df = quick_demo()
# Test agent creation
test_simple_agent()
if df is not None:
print(f"\nπ SUCCESS! Your data analysis setup is working!")
print(f"π Dataset ready: {df.shape[0]} OutSystems log entries")
print(f"π€ AI features will be available once model download completes")
|