jdavis commited on
Commit
af8041d
·
verified ·
1 Parent(s): 51102aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -0
app.py CHANGED
@@ -19,6 +19,21 @@ def image_to_base64_url(img):
19
  img_str = base64.b64encode(buffered.getvalue()).decode()
20
  return f"data:image/png;base64,{img_str}"
21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  # Load model (wrapped in a function to load only when needed)
23
  @st.cache_resource
24
  def load_model():
 
19
  img_str = base64.b64encode(buffered.getvalue()).decode()
20
  return f"data:image/png;base64,{img_str}"
21
 
22
+
23
+ # Authenticate with Hugging Face
24
+ def authenticate():
25
+ token = st.text_input("Enter your Hugging Face token:", type="password",
26
+ help="Find your token at https://huggingface.co/settings/tokens")
27
+ if token:
28
+ try:
29
+ login(token)
30
+ st.success("Successfully authenticated with Hugging Face!")
31
+ return True
32
+ except Exception as e:
33
+ st.error(f"Authentication failed: {e}")
34
+ return False
35
+ return False
36
+
37
  # Load model (wrapped in a function to load only when needed)
38
  @st.cache_resource
39
  def load_model():