yizhangliu commited on
Commit
e0c32c9
·
1 Parent(s): 0a4cac3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -3
app.py CHANGED
@@ -83,7 +83,7 @@ if do_dreamlike_photoreal:
83
 
84
  tab_actions.append(dreamlike_image)
85
  tab_titles.append("Dreamlike_2.0")
86
- thanks_info += "[<a style='display:inline-block' href='https://huggingface.co/models/dreamlike-art/dreamlike-photoreal-2.0' _blank><font style='color:blue;weight:bold;'>dreamlike-photoreal-2.0</font></a>]"
87
 
88
  for space_id in space_ids.keys():
89
  print(space_id, space_ids[space_id])
@@ -125,6 +125,7 @@ start_work = """async() => {
125
  valueSetter.call(element, value);
126
  }
127
  }
 
128
  window['tab_advanced'] = 0;
129
 
130
  var gradioEl = document.querySelector('body > gradio-app').shadowRoot;
@@ -134,8 +135,10 @@ start_work = """async() => {
134
 
135
  if (typeof window['gradioEl'] === 'undefined') {
136
  window['gradioEl'] = gradioEl;
 
137
  tabitems = window['gradioEl'].querySelectorAll('.tabitem');
138
  tabitems_title = window['gradioEl'].querySelectorAll('#tab_demo')[0].children[0].children[0].children;
 
139
  for (var i = 0; i < tabitems.length; i++) {
140
  if (tabitems_title[i].innerText.indexOf('SD') >= 0) {
141
  tabitems[i].childNodes[0].children[0].style.display='none';
@@ -144,6 +147,13 @@ start_work = """async() => {
144
  tabitems[i].childNodes[0].children[1].children[j].style.display='none';
145
  }
146
  }
 
 
 
 
 
 
 
147
  } else if (tabitems_title[i].innerText.indexOf('Taiyi') >= 0) {
148
  tabitems[i].children[0].children[0].children[1].style.display='none';
149
  tabitems[i].children[0].children[0].children[0].children[0].children[1].style.display='none';
@@ -165,6 +175,7 @@ start_work = """async() => {
165
  }
166
  page1.style.display = "none";
167
  page2.style.display = "block";
 
168
  prompt_work = window['gradioEl'].querySelectorAll('#prompt_work');
169
  for (var i = 0; i < prompt_work.length; i++) {
170
  prompt_work[i].style.display='none';
@@ -231,8 +242,13 @@ switch_tab_advanced = """async() => {
231
  tabitems_title = window['gradioEl'].querySelectorAll('#tab_demo')[0].children[0].children[0].children;
232
  for (var i = 0; i < tabitems.length; i++) {
233
  if (tabitems_title[i].innerText.indexOf('SD') >= 0) {
234
- tabitems[i].childNodes[0].children[1].children[0].style.display=action;
235
- tabitems[i].childNodes[0].children[1].children[4].style.display=action;
 
 
 
 
 
236
  } else if (tabitems_title[i].innerText.indexOf('Taiyi') >= 0) {
237
  tabitems[i].children[0].children[0].children[1].style.display=action;
238
  }
 
83
 
84
  tab_actions.append(dreamlike_image)
85
  tab_titles.append("Dreamlike_2.0")
86
+ thanks_info += "[<a style='display:inline-block' href='https://huggingface.co/dreamlike-art/dreamlike-photoreal-2.0' _blank><font style='color:blue;weight:bold;'>dreamlike-photoreal-2.0</font></a>]"
87
 
88
  for space_id in space_ids.keys():
89
  print(space_id, space_ids[space_id])
 
125
  valueSetter.call(element, value);
126
  }
127
  }
128
+
129
  window['tab_advanced'] = 0;
130
 
131
  var gradioEl = document.querySelector('body > gradio-app').shadowRoot;
 
135
 
136
  if (typeof window['gradioEl'] === 'undefined') {
137
  window['gradioEl'] = gradioEl;
138
+
139
  tabitems = window['gradioEl'].querySelectorAll('.tabitem');
140
  tabitems_title = window['gradioEl'].querySelectorAll('#tab_demo')[0].children[0].children[0].children;
141
+
142
  for (var i = 0; i < tabitems.length; i++) {
143
  if (tabitems_title[i].innerText.indexOf('SD') >= 0) {
144
  tabitems[i].childNodes[0].children[0].style.display='none';
 
147
  tabitems[i].childNodes[0].children[1].children[j].style.display='none';
148
  }
149
  }
150
+ if (tabitems_title[i].innerText.indexOf('SD 1') >= 0) {
151
+ for (var j = 0; j < 4; j++) {
152
+ tabitems[i].childNodes[0].children[1].children[3].children[1].children[j].children[2].removeAttribute("disabled");
153
+ }
154
+ } else if (tabitems_title[i].innerText.indexOf('SD 2') >= 0) {
155
+ tabitems[i].children[0].children[1].children[3].children[0].click();
156
+ }
157
  } else if (tabitems_title[i].innerText.indexOf('Taiyi') >= 0) {
158
  tabitems[i].children[0].children[0].children[1].style.display='none';
159
  tabitems[i].children[0].children[0].children[0].children[0].children[1].style.display='none';
 
175
  }
176
  page1.style.display = "none";
177
  page2.style.display = "block";
178
+
179
  prompt_work = window['gradioEl'].querySelectorAll('#prompt_work');
180
  for (var i = 0; i < prompt_work.length; i++) {
181
  prompt_work[i].style.display='none';
 
242
  tabitems_title = window['gradioEl'].querySelectorAll('#tab_demo')[0].children[0].children[0].children;
243
  for (var i = 0; i < tabitems.length; i++) {
244
  if (tabitems_title[i].innerText.indexOf('SD') >= 0) {
245
+ //tabitems[i].childNodes[0].children[1].children[0].style.display=action;
246
+ //tabitems[i].childNodes[0].children[1].children[4].style.display=action;
247
+ for (var j = 0; j < tabitems[i].childNodes[0].children[1].children.length; j++) {
248
+ if (j != 1) {
249
+ tabitems[i].childNodes[0].children[1].children[j].style.display=action;
250
+ }
251
+ }
252
  } else if (tabitems_title[i].innerText.indexOf('Taiyi') >= 0) {
253
  tabitems[i].children[0].children[0].children[1].style.display=action;
254
  }