Spaces:
Runtime error
Runtime error
Upload app-public-space.py
Browse files- app-public-space.py +40 -0
app-public-space.py
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from gradio_client import Client
|
3 |
+
import os
|
4 |
+
|
5 |
+
# HF_TOKEN = os.environ.get('HUGGING_FACE_HUB_TOKEN')
|
6 |
+
HF_TOKEN = os.environ.get('hf_access_to_private_space2')
|
7 |
+
|
8 |
+
def environ_auth(username, password):
|
9 |
+
if username == os.environ.get('mattias_hallberg') and password == os.environ.get('mattias_hallberg_password'):
|
10 |
+
return True
|
11 |
+
elif username == os.environ.get('michal_gradshtein') and password == os.environ.get('michal_gradshtein_password'):
|
12 |
+
return True
|
13 |
+
elif username == os.environ.get('robert_bagares') and password == os.environ.get('robert_bagares_password'):
|
14 |
+
return True
|
15 |
+
elif username == os.environ.get('akiko_kinjo') and password == os.environ.get('akiko_kinjo_password'):
|
16 |
+
return True
|
17 |
+
# elif username == os.environ.get('junichiro_kawashima') and password == os.environ.get('junichiro_kawashima_password'):
|
18 |
+
# return True
|
19 |
+
# elif username == os.environ.get('tomoya_yoshida') and password == os.environ.get('tomoya_yoshida_password'):
|
20 |
+
# return True
|
21 |
+
# elif username == os.environ.get('miho_breen') and password == os.environ.get('miho_breen_password'):
|
22 |
+
# return True
|
23 |
+
# elif username == os.environ.get('nishida_hideaki') and password == os.environ.get('nishida_hideaki_password'):
|
24 |
+
# return True
|
25 |
+
elif username == os.environ.get('casey_wahl') and password == os.environ.get('casey_wahl_password'):
|
26 |
+
return True
|
27 |
+
# elif username == os.environ.get('takeshi_kato') and password == os.environ.get('takeshi_kato_password'):
|
28 |
+
# return True
|
29 |
+
# elif username == os.environ.get('leonard_ogata') and password == os.environ.get('leonard_ogata_password'):
|
30 |
+
# return True
|
31 |
+
# elif username == os.environ.get('hiroyasu_ito') and password == os.environ.get('hiroyasu_ito_password'):
|
32 |
+
# return True
|
33 |
+
elif username == os.environ.get('nawal_behih') and password == os.environ.get('nawal_behih_password'):
|
34 |
+
return True
|
35 |
+
else:
|
36 |
+
return False
|
37 |
+
|
38 |
+
demo = gr.load("attuned-ai/TipGeneratorBot-Private", src="spaces", hf_token=HF_TOKEN)
|
39 |
+
demo.queue(max_size=20)
|
40 |
+
demo.launch(auth=environ_auth, blocked_paths=["/secret"])
|