Update app.py
Browse files
app.py
CHANGED
|
@@ -12,37 +12,6 @@ with gr.Blocks(css="""
|
|
| 12 |
""") as demo:
|
| 13 |
model.render()
|
| 14 |
|
| 15 |
-
# 添加JavaScript来设置默认值并调试界面结构
|
| 16 |
-
<div class="debug-info" id="debug-info"></div>
|
| 17 |
-
<script>
|
| 18 |
-
function setDefaultText() {
|
| 19 |
-
const textareas = document.querySelectorAll('textarea');
|
| 20 |
-
const inputs = document.querySelectorAll('input[type="text"]');
|
| 21 |
-
const debugInfo = document.getElementById('debug-info');
|
| 22 |
-
|
| 23 |
-
let info = `找到 ${textareas.length} 个textarea和 ${inputs.length} 个text input\n`;
|
| 24 |
-
|
| 25 |
-
textareas.forEach((textarea, index) => {
|
| 26 |
-
info += `Textarea ${index}: ${textarea.className}\n`;
|
| 27 |
-
textarea.value = "Hi! Create a image.";
|
| 28 |
-
textarea.dispatchEvent(new Event('input', { bubbles: true }));
|
| 29 |
-
});
|
| 30 |
-
|
| 31 |
-
inputs.forEach((input, index) => {
|
| 32 |
-
info += `Input ${index}: ${input.className}\n`;
|
| 33 |
-
input.value = "Hi! Create a image.";
|
| 34 |
-
input.dispatchEvent(new Event('input', { bubbles: true }));
|
| 35 |
-
});
|
| 36 |
-
|
| 37 |
-
debugInfo.textContent = info;
|
| 38 |
-
debugInfo.style.display = 'block';
|
| 39 |
-
}
|
| 40 |
-
|
| 41 |
-
setTimeout(() => {
|
| 42 |
-
setDefaultText();
|
| 43 |
-
setTimeout(setDefaultText, 1000);
|
| 44 |
-
}, 2000);
|
| 45 |
-
</script>
|
| 46 |
|
| 47 |
with gr.Row():
|
| 48 |
gr.Markdown("""
|
|
|
|
| 12 |
""") as demo:
|
| 13 |
model.render()
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
with gr.Row():
|
| 17 |
gr.Markdown("""
|