ClaCe commited on
Commit
989df3d
·
verified ·
1 Parent(s): b1b598e

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -26
app.py CHANGED
@@ -37,32 +37,12 @@ def log_to_ui(message):
37
  # Initialize embedding model
38
  embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
39
 
40
- # Initialize Llama 3.2 3B model using transformers pipeline with remote inference
41
- HUGGINGFACE_API_KEY = os.getenv("HUGGINGFACE_API_KEY")
42
-
43
- try:
44
- if HUGGINGFACE_API_KEY:
45
- print("🔐 Logging in to HuggingFace for gated model access...")
46
- login(token=HUGGINGFACE_API_KEY)
47
- print("✅ Successfully logged in to HuggingFace")
48
-
49
- print("Initializing Gemma 2 2B via transformers pipeline (remote inference)...")
50
- generator = pipeline(
51
- "text-generation",
52
- model="google/gemma-2-2b-it",
53
- token=HUGGINGFACE_API_KEY # Updated parameter name
54
- )
55
- print("✅ Gemma 2 2B model initialized successfully")
56
- llm_available = True
57
- else:
58
- print("No HuggingFace API key found - will use template responses")
59
- generator = None
60
- llm_available = False
61
- except Exception as e:
62
- print(f"Error initializing Gemma 2 2B: {e}")
63
- print("Falling back to template responses")
64
- generator = None
65
- llm_available = False
66
 
67
  # Auto-extract ChromaDB if archive exists and directory is missing/empty
68
  def setup_chromadb():
 
37
  # Initialize embedding model
38
  embedding_model = SentenceTransformer('all-MiniLM-L6-v2')
39
 
40
+ # BYOK: No server-side API key initialization
41
+ # All model access will be done via user-provided API keys
42
+ print("🔑 BYOK Mode: No server-side API key configured")
43
+ print("✅ Users will provide their own HuggingFace API keys")
44
+ generator = None
45
+ llm_available = False
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  # Auto-extract ChromaDB if archive exists and directory is missing/empty
48
  def setup_chromadb():