import gradio as gr from roboflow2huggingface import roboflow_to_huggingface_pipeline # https://pypi.org/project/roboflow2huggingface/ def process(rf_public_url, hf_api_key, rf_api_key, dataset_name): if not rf_public_url.startswith("https://universe.roboflow.com"): return "URL should start with https://universe.roboflow.com" if not hf_api_key: return "Hugging Face API key required, find it at https://huggingface.co/settings/tokens" if not rf_api_key: return "Roboflow API key required" if not dataset_name: dataset_name = roboflow_universe_url.split("/")[:-3] roboflow_to_huggingface_pipeline( roboflow_universe_url=rf_public_url, roboflow_api_key=rf_api_key, hf_dataset_id=dataset_name, hf_write_token=hf_api_key, ) return "Done" iface = gr.Interface(fn=process, inputs=[ gr.Textbox(label="Roboflow Universe Public URL"), gr.Textbox(label="Hugging Face API key"), gr.Textbox(label="Roboflow API key"), gr.Textbox(label="Dataset name for Hugging Face side") ], outputs=["text"]) iface.launch()