Update app.py
Browse files
app.py
CHANGED
@@ -50,7 +50,6 @@ def process_image(image):
|
|
50 |
|
51 |
css = """
|
52 |
#output {
|
53 |
-
height: 450px;
|
54 |
overflow: auto;
|
55 |
border: 1px solid #ccc;
|
56 |
padding: 10px;
|
@@ -59,6 +58,20 @@ css = """
|
|
59 |
}
|
60 |
"""
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
with gr.Blocks(css=css) as demo:
|
63 |
gr.Markdown(DESCRIPTION)
|
64 |
with gr.Tab(label="Product Image Select"):
|
@@ -88,4 +101,4 @@ with gr.Blocks(css=css) as demo:
|
|
88 |
|
89 |
submit_btn.click(process_image, [input_img], [output_text])
|
90 |
|
91 |
-
demo.launch(debug=True)
|
|
|
50 |
|
51 |
css = """
|
52 |
#output {
|
|
|
53 |
overflow: auto;
|
54 |
border: 1px solid #ccc;
|
55 |
padding: 10px;
|
|
|
58 |
}
|
59 |
"""
|
60 |
|
61 |
+
js = """
|
62 |
+
function adjustHeight() {
|
63 |
+
var outputElement = document.getElementById('output');
|
64 |
+
outputElement.style.height = 'auto'; // Reset height to auto to get the actual content height
|
65 |
+
var height = outputElement.scrollHeight + 'px'; // Get the scrollHeight
|
66 |
+
outputElement.style.height = height; // Set the height
|
67 |
+
}
|
68 |
+
|
69 |
+
// Attach the adjustHeight function to the click event of the submit button
|
70 |
+
document.querySelector('button').addEventListener('click', function() {
|
71 |
+
setTimeout(adjustHeight, 500); // Adjust the height after a small delay to ensure content is loaded
|
72 |
+
});
|
73 |
+
"""
|
74 |
+
|
75 |
with gr.Blocks(css=css) as demo:
|
76 |
gr.Markdown(DESCRIPTION)
|
77 |
with gr.Tab(label="Product Image Select"):
|
|
|
101 |
|
102 |
submit_btn.click(process_image, [input_img], [output_text])
|
103 |
|
104 |
+
demo.launch(debug=True, include_js=js)
|