Spaces:
Paused
Paused
add password login
Browse files- app.py +14 -1
- passwords.txt +2 -0
app.py
CHANGED
|
@@ -283,5 +283,18 @@ with gr.Blocks() as demo:
|
|
| 283 |
# advanced.click(show_advanced, inputs=[], outputs=[model, temperature])
|
| 284 |
|
| 285 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 286 |
if __name__ == '__main__':
|
| 287 |
-
demo.launch()
|
|
|
|
| 283 |
# advanced.click(show_advanced, inputs=[], outputs=[model, temperature])
|
| 284 |
|
| 285 |
|
| 286 |
+
def authf(username, password):
|
| 287 |
+
try:
|
| 288 |
+
with open("passwords.txt", "r") as f:
|
| 289 |
+
for line in f.readlines():
|
| 290 |
+
if line.strip() == f"{username}:{password}":
|
| 291 |
+
return True
|
| 292 |
+
except Exception as e:
|
| 293 |
+
print("Error reading password", e)
|
| 294 |
+
traceback.print_exc()
|
| 295 |
+
|
| 296 |
+
return False
|
| 297 |
+
|
| 298 |
+
|
| 299 |
if __name__ == '__main__':
|
| 300 |
+
demo.launch(server_name="0.0.0.0", auth=authf)
|
passwords.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
admin:duckDuck9o
|
| 2 |
+
user1@dreem.ai:Cyywh9
|