saikub commited on
Commit
87d0dba
·
verified ·
1 Parent(s): 14578a6

Create run_app.py

Browse files
Files changed (1) hide show
  1. run_app.py +32 -0
run_app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from gradio_auth import Auth
3
+ import subprocess
4
+
5
+ # Define your username and password
6
+ USERNAME = "your_username"
7
+ PASSWORD = "your_password"
8
+
9
+ # Create an authentication object
10
+ auth = Auth((USERNAME, PASSWORD))
11
+
12
+ # Define a dummy function to initiate Gradio
13
+ def dummy_function(input_text):
14
+ return "Authentication successful. Starting the app..."
15
+
16
+ # Create a Gradio interface with authentication
17
+ iface = gr.Interface(
18
+ fn=dummy_function,
19
+ inputs="text",
20
+ outputs="text",
21
+ auth=auth
22
+ )
23
+
24
+ # Launch the dummy interface to handle authentication
25
+ iface.launch(
26
+ server_name="0.0.0.0",
27
+ server_port=7860,
28
+ prevent_thread_lock=True
29
+ )
30
+
31
+ # After successful authentication, run the actual app
32
+ subprocess.run(["python", "app_w_lora.py"])