Files
topoteretes--cognee/examples/demos/start_local_ui_frontend_example.py
wehub-resource-sync c889a57b6b
Test Suites / Build CI Environment (push) Has been cancelled
Test Suites / Basic Tests (push) Has been cancelled
Test Suites / End-to-End Tests (push) Has been cancelled
Test Suites / CLI Tests (push) Has been cancelled
Test Suites / Slow End-to-End Tests (push) Has been cancelled
Test Suites / Graph Database Tests (push) Has been cancelled
Test Suites / Vector DB Tests (push) Has been cancelled
Test Suites / Temporal Graph Test (push) Has been cancelled
Test Suites / Search Test on Different DBs (push) Has been cancelled
Test Suites / Example Tests (push) Has been cancelled
Test Suites / Notebook Tests (push) Has been cancelled
Test Suites / OS and Python Tests Ubuntu (push) Has been cancelled
Test Suites / OS and Python Tests Extended (push) Has been cancelled
Test Suites / LLM Test Suite (push) Has been cancelled
Test Suites / S3 File Storage Test (push) Has been cancelled
Test Suites / Run Integration Tests (push) Has been cancelled
Test Suites / MCP Tests (push) Has been cancelled
Test Suites / Docker Compose Test (push) Has been cancelled
Test Suites / Docker CI test (push) Has been cancelled
Test Suites / Relational DB Migration Tests (push) Has been cancelled
Test Suites / Distributed Cognee Test (push) Has been cancelled
Test Suites / DB Examples Tests (push) Has been cancelled
Test Suites / Test Completion Status (push) Has been cancelled
Test Suites / Claude Code Review (push) Has been cancelled
Test Suites / basic checks (push) Has been cancelled
build | Build and Push Cognee MCP Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
build | Build and Push Docker Image to dockerhub / docker-build-and-push (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.11) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Core Functionality (3.12) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (kuzu, kuzu) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges with Different Graph Databases (neo4j, neo4j) (push) Has been cancelled
Weighted Edges Tests / Test Weighted Edges Examples (push) Has been cancelled
Weighted Edges Tests / Code Quality for Weighted Edges (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 13:02:24 +08:00

59 lines
1.7 KiB
Python

#!/usr/bin/env python3
"""
Example showing how to use cognee.start_ui() to launch the frontend.
This demonstrates the new UI functionality that works similar to DuckDB's start_ui().
"""
import asyncio
import time
import cognee
async def main():
# First, let's add some data to cognee for the UI to display
print("Adding sample data to cognee...")
await cognee.remember(
[
"Natural language processing (NLP) is an interdisciplinary subfield of computer science and information retrieval.",
"Machine learning (ML) is a subset of artificial intelligence that focuses on algorithms and statistical models.",
],
self_improvement=False,
)
print("\n" + "=" * 60)
print("Starting cognee UI...")
print("=" * 60)
# Start the UI server
def dummy_callback(pid):
pass
server = cognee.start_ui(
pid_callback=dummy_callback,
port=3000,
open_browser=True, # This will automatically open your browser
)
if server:
print("UI server started successfully!")
print("The interface will be available at: http://localhost:3000")
print("\nPress Ctrl+C to stop the server when you're done...")
try:
# Keep the server running
while server.poll() is None: # While process is still running
time.sleep(1)
except KeyboardInterrupt:
print("\nStopping UI server...")
server.terminate()
server.wait() # Wait for process to finish
print("UI server stopped.")
else:
print("Failed to start UI server. Check the logs above for details.")
if __name__ == "__main__":
asyncio.run(main())