Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
| 128 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
+
)
|