Spaces:
Runtime error
Runtime error
wendys-llc
commited on
Commit
•
fc549f0
1
Parent(s):
e1c70ba
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from roboflow2huggingface import roboflow_to_huggingface_pipeline
|
3 |
+
|
4 |
+
# https://pypi.org/project/roboflow2huggingface/
|
5 |
+
def process(rf_public_url, hf_api_key, rf_api_key, dataset_name):
|
6 |
+
if not rf_public_url.startswith("https://universe.roboflow.com"):
|
7 |
+
return "URL should start with https://universe.roboflow.com"
|
8 |
+
if not hf_api_key:
|
9 |
+
return "Hugging Face API key required, find it at https://huggingface.co/settings/tokens"
|
10 |
+
if not rf_api_key:
|
11 |
+
return "Roboflow API key required"
|
12 |
+
if not dataset_name:
|
13 |
+
dataset_name = roboflow_universe_url.split("/")[:-3]
|
14 |
+
|
15 |
+
roboflow_to_huggingface_pipeline(
|
16 |
+
roboflow_universe_url=rf_public_url,
|
17 |
+
roboflow_api_key=rf_api_key,
|
18 |
+
hf_dataset_id=dataset_name,
|
19 |
+
hf_write_token=hf_api_key,
|
20 |
+
)
|
21 |
+
|
22 |
+
return "Done"
|
23 |
+
|
24 |
+
iface = gr.Interface(fn=process,
|
25 |
+
inputs=[
|
26 |
+
gr.Textbox(label="Roboflow Universe Public URL"),
|
27 |
+
gr.Textbox(label="Hugging Face API key"),
|
28 |
+
gr.Textbox(label="Roboflow API key"),
|
29 |
+
gr.Textbox(label="Dataset name for Hugging Face side")
|
30 |
+
],
|
31 |
+
outputs=["text"])
|
32 |
+
iface.launch()
|