cahya commited on
Commit
b5a7127
·
1 Parent(s): 86bd374

add a mirror url as env variable

Browse files
Files changed (1) hide show
  1. app/app.py +7 -2
app/app.py CHANGED
@@ -9,9 +9,14 @@ import psutil
9
  import codecs
10
  import streamlit.components.v1 as stc
11
  import pathlib
 
12
 
13
  # st.set_page_config(page_title="Indonesian GPT-2")
14
 
 
 
 
 
15
  MODELS = {
16
  "Indonesian GPT-2 Small": {
17
  "group": "Indonesian GPT-2",
@@ -74,7 +79,7 @@ st.sidebar.markdown("""
74
  <img src="https://huggingface.co/spaces/flax-community/gpt2-indonesian/resolve/main/huggingwayang.png"/>
75
  </p>
76
  """, unsafe_allow_html=True)
77
- st.sidebar.markdown("""
78
  ___
79
  <p class="centeralign">
80
  This is a collection of applications that generates sentences using Indonesian GPT-2 models!
@@ -84,7 +89,7 @@ Created by <a href="https://huggingface.co/indonesian-nlp">Indonesian NLP</a> te
84
  <br/>
85
  <a href="https://github.com/indonesian-nlp/gpt2-app" target="_blank">GitHub</a> | <a href="https://github.com/indonesian-nlp/gpt2-app" target="_blank">Project Report</a>
86
  <br/>
87
- A mirror is available at <a href="https://gpt2-app.ai-research.id/" target="_blank">ai-research.id</a>
88
  </p>
89
  """, unsafe_allow_html=True)
90
 
 
9
  import codecs
10
  import streamlit.components.v1 as stc
11
  import pathlib
12
+ import os
13
 
14
  # st.set_page_config(page_title="Indonesian GPT-2")
15
 
16
+ mirror_url = "https://gpt2-app.ai-research.id/"
17
+ if "MIRROR_URL" in os.environ:
18
+ mirror_url = os.environ["MIRROR_URL"]
19
+
20
  MODELS = {
21
  "Indonesian GPT-2 Small": {
22
  "group": "Indonesian GPT-2",
 
79
  <img src="https://huggingface.co/spaces/flax-community/gpt2-indonesian/resolve/main/huggingwayang.png"/>
80
  </p>
81
  """, unsafe_allow_html=True)
82
+ st.sidebar.markdown(f"""
83
  ___
84
  <p class="centeralign">
85
  This is a collection of applications that generates sentences using Indonesian GPT-2 models!
 
89
  <br/>
90
  <a href="https://github.com/indonesian-nlp/gpt2-app" target="_blank">GitHub</a> | <a href="https://github.com/indonesian-nlp/gpt2-app" target="_blank">Project Report</a>
91
  <br/>
92
+ A mirror of the application is available <a href="{mirror_url}" target="_blank">here</a>
93
  </p>
94
  """, unsafe_allow_html=True)
95