Nymbo commited on
Commit
12fba52
1 Parent(s): 8379d73

implement these lines to add a username/pw check to your Space

Browse files
Files changed (1) hide show
  1. adding auth to spaces +22 -0
adding auth to spaces ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GRADIO AUTHENTICATION SETUP
2
+
3
+ # Add these snippets to your app.py file to require a username and password.
4
+
5
+ import os
6
+ import gradio as gr
7
+
8
+ # Define your Gradio app's interface and functions here
9
+
10
+ # Environment variables for username and password
11
+ username = os.environ.get("MY_APP_USERNAME")
12
+ password = os.environ.get("MY_APP_PASSWORD")
13
+
14
+ # Launch the Gradio app with basic authentication
15
+ app.launch(auth=(username, password))
16
+
17
+
18
+
19
+
20
+ # SET ENVIRONMENT VARIABLES
21
+ # MY_APP_USERNAME = "your_username"
22
+ # MY_APP_PASSWORD = "your_password"