Spaces:
Runtime error
Runtime error
File size: 1,266 Bytes
fc549f0 |
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 |
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()
|