Spaces:
Runtime error
Runtime error
File size: 1,964 Bytes
7b6bb0b 2e0a564 7b6bb0b 2e0a564 7b6bb0b 2e0a564 7b6bb0b 2e0a564 7b6bb0b 2e0a564 7b6bb0b 2e0a564 0cb0203 2e0a564 7b6bb0b 2e0a564 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
import gradio as gr
from gradio_huggingfacehub_search import HuggingfaceHubSearch
from gradio_rerun import Rerun
def predict(search_in: str, file_path: str | list[str], url: str):
if url:
return url
return file_path
with gr.Blocks(css=".gradio-container { max-width: unset!important; }") as demo:
with gr.Row():
with gr.Column():
search_in = HuggingfaceHubSearch(
label="Search Models on Huggingface Hub and convert to rrd",
placeholder="Search for models on Huggingface",
search_type="model",
)
with gr.Group():
file_path = gr.File(file_count="multiple", type="filepath")
url = gr.Text(
info="Or use a URL",
label="URL",
)
with gr.Column():
pass
btn = gr.Button("Run", scale=0)
with gr.Row():
rerun_viewer = Rerun(height=900)
inputs = [search_in, file_path, url]
outputs = [rerun_viewer]
gr.on(
[btn.click, search_in.submit],
fn=predict,
inputs=inputs,
outputs=outputs,
)
gr.on([btn.click, file_path.upload], fn=predict, inputs=inputs, outputs=outputs)
gr.Examples(
examples=[
[
None,
["./examples/rgbd.rrd"],
None,
],
[
None,
["./examples/rrt-star.rrd"],
None,
],
[
None,
["./examples/structure_from_motion.rrd"],
None,
],
[
None,
["./examples/structure_from_motion.rrd", "./examples/rrt-star.rrd"],
None,
],
],
fn=predict,
inputs=inputs,
outputs=outputs,
run_on_click=True,
)
if __name__ == "__main__":
demo.launch()
|