AI_TEXT_to_GIF / run_app.py
saikub's picture
Create run_app.py
87d0dba verified
raw
history blame
762 Bytes
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"])