|
import gradio as gr |
|
|
|
|
|
|
|
problematic_url = "https://huggingface.co/Norod78/JojosoStyle-flux-lora/resolve/main/samples/1725217578243__000000000_0.jpg" |
|
|
|
|
|
sample_data = [ |
|
{ |
|
"title": "Sample LoRA", |
|
"image": problematic_url, |
|
"repo": "some/repo" |
|
} |
|
] |
|
|
|
def dummy_function(text_input, state_data): |
|
""" |
|
This function should be called when button is clicked, |
|
but the error occurs before it even executes. |
|
""" |
|
print("Function was called!") |
|
return f"Processed: {text_input}", state_data |
|
|
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("# Gradio SSRF Bug Reproduction") |
|
gr.Markdown("Click the button below. You should see an error about hostname validation.") |
|
|
|
|
|
state_var = gr.State(sample_data) |
|
|
|
|
|
text_input = gr.Textbox(label="Enter some text", value="test") |
|
|
|
|
|
output = gr.Textbox(label="Output") |
|
|
|
|
|
button = gr.Button("Click me - this will fail") |
|
|
|
|
|
|
|
button.click( |
|
fn=dummy_function, |
|
inputs=[text_input, state_var], |
|
outputs=[output, state_var] |
|
) |
|
|
|
if __name__ == "__main__": |
|
demo.launch() |