multimodalart HF Staff commited on
Commit
d105177
·
verified ·
1 Parent(s): 51a4505

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -6
app.py CHANGED
@@ -8,22 +8,26 @@ data_with_hf_url = [
8
  }
9
  ]
10
 
11
- def test_function(state_data):
12
  print("This function will never be called due to SSRF validation error")
13
- return gr.update()
14
 
15
  with gr.Blocks() as demo:
16
- # Initialize state with problematic HuggingFace URL
17
  state_with_urls = gr.State(data_with_hf_url)
 
18
 
 
19
  button = gr.Button("Click me to trigger SSRF error")
20
- output = gr.Textbox()
 
21
 
22
  # This will fail with: ValueError: Hostname cas-bridge-direct.xethub.hf.co failed validation
 
23
  button.click(
24
  test_function,
25
- inputs=[state_with_urls], # Passing state with HF URLs causes SSRF validation error
26
- outputs=[output]
27
  )
28
 
29
  demo.launch()
 
8
  }
9
  ]
10
 
11
+ def test_function(text_input, state_data, other_state):
12
  print("This function will never be called due to SSRF validation error")
13
+ return gr.update(), gr.update()
14
 
15
  with gr.Blocks() as demo:
16
+ # Multiple inputs including state with problematic URLs
17
  state_with_urls = gr.State(data_with_hf_url)
18
+ other_state = gr.State([])
19
 
20
+ text_input = gr.Textbox(label="Text Input")
21
  button = gr.Button("Click me to trigger SSRF error")
22
+ output1 = gr.Textbox()
23
+ output2 = gr.Textbox()
24
 
25
  # This will fail with: ValueError: Hostname cas-bridge-direct.xethub.hf.co failed validation
26
+ # The key is having MULTIPLE inputs where one contains the problematic URLs
27
  button.click(
28
  test_function,
29
+ inputs=[text_input, state_with_urls, other_state], # Multiple inputs with HF URLs causes SSRF error
30
+ outputs=[output1, output2]
31
  )
32
 
33
  demo.launch()