Alejadro Sanchez-Giraldo commited on
Commit
ca5fd4e
1 Parent(s): a250953

add LD attributes

Browse files
Files changed (2) hide show
  1. .gitignore +2 -1
  2. app.py +17 -1
.gitignore CHANGED
@@ -1 +1,2 @@
1
- myenv/
 
 
1
+ myenv/
2
+ .DS_Store
app.py CHANGED
@@ -2,4 +2,20 @@ import streamlit as st
2
  from transformers import pipeline
3
  from ldclient import LDClient, Config, Context
4
  import os
5
- import torch
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  from transformers import pipeline
3
  from ldclient import LDClient, Config, Context
4
  import os
5
+ import torch
6
+
7
+ # Retrieve the LaunchDarkly SDK key from environment variables
8
+ ld_sdk_key = os.getenv("LAUNCHDARKLY_SDK_KEY")
9
+
10
+ # Initialize LaunchDarkly client with the correct configuration
11
+ ld_client = LDClient(Config(ld_sdk_key))
12
+
13
+ # Set the user context for LaunchDarkly
14
+ user = {
15
+ "key": "test-user",
16
+ "custom": {
17
+ "groups": "beta_testers"
18
+ }
19
+ }
20
+
21
+ context = Context(user)