import gradio as gr from gradio_client import Client import os # HF_TOKEN = os.environ.get('HUGGING_FACE_HUB_TOKEN') HF_TOKEN = os.environ.get('hf_access_to_private_space2') def environ_auth(username, password, request: gr.Request): if request: print("Request headers dictionary:", request.headers) print("IP address:", request.client.host) print("Username:", request.username) print("Query parameters:", dict(request.query_params)) print("Session hash:", request.session_hash) if username == os.environ.get('mattias_hallberg') and password == os.environ.get('mattias_hallberg_password'): return True elif username == os.environ.get('michal_gradshtein') and password == os.environ.get('michal_gradshtein_password'): return True elif username == os.environ.get('robert_bagares') and password == os.environ.get('robert_bagares_password'): return True elif username == os.environ.get('akiko_kinjo') and password == os.environ.get('akiko_kinjo_password'): return True # elif username == os.environ.get('junichiro_kawashima') and password == os.environ.get('junichiro_kawashima_password'): # return True # elif username == os.environ.get('tomoya_yoshida') and password == os.environ.get('tomoya_yoshida_password'): # return True # elif username == os.environ.get('miho_breen') and password == os.environ.get('miho_breen_password'): # return True # elif username == os.environ.get('nishida_hideaki') and password == os.environ.get('nishida_hideaki_password'): # return True elif username == os.environ.get('casey_wahl') and password == os.environ.get('casey_wahl_password'): return True # elif username == os.environ.get('takeshi_kato') and password == os.environ.get('takeshi_kato_password'): # return True # elif username == os.environ.get('leonard_ogata') and password == os.environ.get('leonard_ogata_password'): # return True # elif username == os.environ.get('hiroyasu_ito') and password == os.environ.get('hiroyasu_ito_password'): # return True elif username == os.environ.get('nawal_behih') and password == os.environ.get('nawal_behih_password'): return True else: return False demo = gr.load("attuned-ai/TipGeneratorBot-Private", src="spaces", hf_token=HF_TOKEN) demo.queue(max_size=20) demo.launch(auth=environ_auth, blocked_paths=["/secret"])