datasaur-dev commited on
Commit
476fbdb
·
verified ·
1 Parent(s): 8e6312c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -2,6 +2,14 @@ import gradio as gr
2
  import pandas as pd
3
  import time
4
 
 
 
 
 
 
 
 
 
5
  # --- Core Application Logic ---
6
  def analyze_wod(file_obj, wod_type):
7
  """
@@ -122,7 +130,11 @@ with gr.Blocks(
122
  outputs=[results_output]
123
  )
124
 
125
- # --- Launch the Application ---
126
  if __name__ == "__main__":
127
- # The launch() command creates a web server and a public link if needed.
128
- demo.launch()
 
 
 
 
 
2
  import pandas as pd
3
  import time
4
 
5
+ # --- Authentication Function ---
6
+ def authenticate_user(username, password):
7
+ """
8
+ Simple authentication function.
9
+ In production, you should use more secure methods like hashed passwords.
10
+ """
11
+ return username == "demo" and password == "demo"
12
+
13
  # --- Core Application Logic ---
14
  def analyze_wod(file_obj, wod_type):
15
  """
 
130
  outputs=[results_output]
131
  )
132
 
133
+ # --- Launch the Application with Authentication ---
134
  if __name__ == "__main__":
135
+ # The launch() command creates a web server with authentication enabled
136
+ # Users must provide the correct username and password to access the app
137
+ demo.launch(
138
+ auth=authenticate_user, # Enable authentication
139
+ auth_message="Please enter your credentials to access the WOD Analyzer",
140
+ )