Spaces:
Sleeping
Sleeping
File size: 1,692 Bytes
0f77bc1 |
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 |
#!/usr/bin/env python
# quick_start.py - Quick start script to run the app
import subprocess
import sys
import os
from pathlib import Path
def run_command(cmd, description=""):
"""Run a shell command"""
if description:
print(f"π¨ {description}")
print(f" β {cmd}")
result = subprocess.run(cmd, shell=True)
if result.returncode != 0:
print(f"β Error: Command failed")
return False
return True
def main():
print("π§© SAP Intelligent Assistant - Quick Start")
print("=" * 50)
print()
# Check if virtual environment exists
venv_path = Path(".venv")
if not venv_path.exists():
print("β Virtual environment not found!")
print(" Run: python setup.sh")
sys.exit(1)
# Activate venv and check if RAG index exists
index_path = Path("data/rag_index.faiss")
if not index_path.exists():
print("β οΈ RAG index not found. Building dataset and index...")
print()
# Build dataset
if not run_command(
"source .venv/bin/activate && python tools/build_dataset.py",
"Building dataset from web sources"
):
sys.exit(1)
print()
# Build index
if not run_command(
"source .venv/bin/activate && python tools/embeddings.py",
"Building RAG index"
):
sys.exit(1)
print()
print("β
All systems ready!")
print()
print("Starting Streamlit app...")
print()
# Run streamlit
os.system("source .venv/bin/activate && streamlit run app.py")
if __name__ == "__main__":
main()
|