File size: 762 Bytes
87d0dba
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gradio as gr
from gradio_auth import Auth
import subprocess

# Define your username and password
USERNAME = "your_username"
PASSWORD = "your_password"

# Create an authentication object
auth = Auth((USERNAME, PASSWORD))

# Define a dummy function to initiate Gradio
def dummy_function(input_text):
    return "Authentication successful. Starting the app..."

# Create a Gradio interface with authentication
iface = gr.Interface(
    fn=dummy_function,
    inputs="text",
    outputs="text",
    auth=auth
)

# Launch the dummy interface to handle authentication
iface.launch(
    server_name="0.0.0.0",
    server_port=7860,
    prevent_thread_lock=True
)

# After successful authentication, run the actual app
subprocess.run(["python", "app_w_lora.py"])