Pijush2023 commited on
Commit
046760c
·
verified ·
1 Parent(s): 5203bf1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -0
app.py CHANGED
@@ -1806,6 +1806,27 @@ with gr.Blocks(theme='Pijush2023/scikit-learn-pijush') as demo:
1806
 
1807
  refresh_button = gr.Button("Refresh Images")
1808
  refresh_button.click(fn=update_images, inputs=None, outputs=[image_output_1, image_output_2, image_output_3], api_name="update_image")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1809
 
1810
  demo.queue()
1811
  demo.launch(share=True)
 
1806
 
1807
  refresh_button = gr.Button("Refresh Images")
1808
  refresh_button.click(fn=update_images, inputs=None, outputs=[image_output_1, image_output_2, image_output_3], api_name="update_image")
1809
+
1810
+ # Add custom JavaScript
1811
+ demo.add_script("""
1812
+ function handleRetrievalModeChange() {
1813
+ const retrievalMode = document.querySelector('input[name="Retrieval Mode"]:checked').value;
1814
+ const choiceRadios = document.querySelectorAll('input[name="Select Style"]');
1815
+
1816
+ if (retrievalMode === 'Knowledge-Graph') {
1817
+ choiceRadios.forEach(radio => radio.disabled = true);
1818
+ } else {
1819
+ choiceRadios.forEach(radio => radio.disabled = false);
1820
+ }
1821
+ }
1822
+
1823
+ document.querySelectorAll('input[name="Retrieval Mode"]').forEach(radio => {
1824
+ radio.addEventListener('change', handleRetrievalModeChange);
1825
+ });
1826
+
1827
+ // Initialize the state based on the default selected value
1828
+ handleRetrievalModeChange();
1829
+ """)
1830
 
1831
  demo.queue()
1832
  demo.launch(share=True)