Mariia5 commited on
Commit
22fbcee
·
verified ·
1 Parent(s): 5a1fe33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +54 -0
app.py CHANGED
@@ -108,6 +108,60 @@ def main():
108
  pdf_files_list = []
109
  docx_files_list = []
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  # Кнопка для загрузки PDF файла
112
  pdf_files = st.file_uploader("Загрузите PDF Извещения", type=["pdf"], accept_multiple_files=True)
113
  for pdf_file in pdf_files:
 
108
  pdf_files_list = []
109
  docx_files_list = []
110
 
111
+ languages = { #перевод кнопок
112
+ "EN": {
113
+ "button": "Browse Files",
114
+ "instructions": "Drag and drop files here",
115
+ "limits": "Limit 200MB per file",
116
+ },
117
+ "RU": {
118
+ "button": "Добавить",
119
+ "instructions": "Загрузите файл",
120
+ "limits": "Ограничение объема файла 200MB",
121
+ },
122
+ }
123
+ lang = st.radio("", options=["EN", "RU"],index=1, horizontal=True)
124
+
125
+ hide_label = (
126
+ """
127
+ <style>
128
+ div[data-testid="stFileUploader"]>section[data-testid="stFileUploadDropzone"]>button[data-testid="baseButton-secondary"] {
129
+ color:white;
130
+ }
131
+ div[data-testid="stFileUploader"]>section[data-testid="stFileUploadDropzone"]>button[data-testid="baseButton-secondary"]::after {
132
+ content: "BUTTON_TEXT";
133
+ color:black;
134
+ display: block;
135
+ position: absolute;
136
+ }
137
+ div[data-testid="stFileDropzoneInstructions"]>div>span {
138
+ visibility:hidden;
139
+ }
140
+ div[data-testid="stFileDropzoneInstructions"]>div>span::after {
141
+ content:"INSTRUCTIONS_TEXT";
142
+ visibility:visible;
143
+ display:block;
144
+ }
145
+ div[data-testid="stFileDropzoneInstructions"]>div>small {
146
+ visibility:hidden;
147
+ }
148
+ div[data-testid="stFileDropzoneInstructions"]>div>small::before {
149
+ content:"FILE_LIMITS";
150
+ visibility:visible;
151
+ display:block;
152
+ }
153
+ </style>
154
+ """.replace(
155
+ "BUTTON_TEXT", languages.get(lang).get("button") #.get(lang)
156
+ )
157
+ .replace("INSTRUCTIONS_TEXT", languages.get(lang).get("instructions")) #.get(lang)
158
+ .replace("FILE_LIMITS", languages.get(lang).get("limits")) #get(lang)
159
+ )
160
+ st.markdown(hide_label, unsafe_allow_html=True)
161
+
162
+
163
+
164
+
165
  # Кнопка для загрузки PDF файла
166
  pdf_files = st.file_uploader("Загрузите PDF Извещения", type=["pdf"], accept_multiple_files=True)
167
  for pdf_file in pdf_files: