defsentence_builder(quantity, animal, countries, place, morning): returnf"""The {quantity}{animal}s from {" and ".join(countries)} went to the {place} in the {"morning"if morning else"night"}"""
with gr.Blocks() as demo:
gr.Markdown("Choose the options and then click **Run** to see the output.") with gr.Row(): quantity = gr.Slider(2, 20, value=4, label="Count", info="Choose between 2 and 20") animal = gr.Dropdown(["cat", "dog", "bird"], label="Animal", info="Will add more animals later!") countries = gr.CheckboxGroup(["USA", "Japan", "Pakistan"], label="Countries", info="Where are they from?") place = gr.Radio(["park", "zoo", "road"], label="Location", info="Where did they go?") morning = gr.Checkbox(label="Morning", info="Did they do it in the morning?")
with gr.Blocks() as demo: gr.Markdown("Create caption files for images in a directory") with gr.Row(): folder = gr.Textbox(placeholder="Directory to caption") logs = gr.Checkbox(label="Add verbose logs")
class GradioInterface extends RemoteFlowSource::Range{ GradioInterface(){ exists(API::CallNode n | n = API::moduleImport("gradio").getMember("Interface").getACall() and this = n.getParameter(0, "fn").getParameter(_).asSource()) } override string getSourceType(){result= "Gradio vuln input"} }
from GradioInterface src select src, "Gradio sources"
class GradioInterface extends RemoteFlowSource::Range{ GradioInterface(){ exists(API::CallNode n | n = API::moduleImport("gradio").getMember("Button").getReturn().getMember("click").getACall() and this = n.getParameter(0, "fn").getParameter(_).asSource()) } override string getSourceType(){result= "Gradio Blocks vuln input"} }
from GradioInterface src select src, "Gradio sources"
class GradioButton extends RemoteFlowSource::Range { GradioButton() { exists(API::CallNode n | n = API::moduleImport("gradio").getMember("Button").getReturn() .getMember("click").getACall() | this = n.getParameter(0, "fn").getParameter(_).asSource()) }
from MyFlow::PathNode source, MyFlow::PathNode sink where MyFlow::flowPath(source, sink) select sink.getNode(), source, sink, "Data Flow from a Gradio source to `os.system`"