Spaces:
Running
Running
update
Browse files
app.py
CHANGED
|
@@ -1567,8 +1567,11 @@ with gr.Blocks(
|
|
| 1567 |
# Transformers.js logic
|
| 1568 |
elif sdk_name == "Transformers.js":
|
| 1569 |
try:
|
| 1570 |
-
# Use
|
| 1571 |
-
|
|
|
|
|
|
|
|
|
|
| 1572 |
from_id="static-templates/transformers.js",
|
| 1573 |
to_id=space_name.strip(),
|
| 1574 |
token=token.token,
|
|
@@ -1632,7 +1635,7 @@ with gr.Blocks(
|
|
| 1632 |
repo_id=repo_id,
|
| 1633 |
repo_type="space"
|
| 1634 |
)
|
| 1635 |
-
space_url =
|
| 1636 |
return gr.update(value=f"✅ Deployed! [Open your Transformers.js Space here]({space_url})", visible=True)
|
| 1637 |
except Exception as e:
|
| 1638 |
return gr.update(value=f"Error uploading style.css: {e}", visible=True)
|
|
|
|
| 1567 |
# Transformers.js logic
|
| 1568 |
elif sdk_name == "Transformers.js":
|
| 1569 |
try:
|
| 1570 |
+
# Use duplicate_space to create a transformers.js template space
|
| 1571 |
+
from huggingface_hub import duplicate_space
|
| 1572 |
+
|
| 1573 |
+
# Duplicate the transformers.js template space
|
| 1574 |
+
duplicated_repo = duplicate_space(
|
| 1575 |
from_id="static-templates/transformers.js",
|
| 1576 |
to_id=space_name.strip(),
|
| 1577 |
token=token.token,
|
|
|
|
| 1635 |
repo_id=repo_id,
|
| 1636 |
repo_type="space"
|
| 1637 |
)
|
| 1638 |
+
space_url = f"https://huggingface.co/spaces/{repo_id}"
|
| 1639 |
return gr.update(value=f"✅ Deployed! [Open your Transformers.js Space here]({space_url})", visible=True)
|
| 1640 |
except Exception as e:
|
| 1641 |
return gr.update(value=f"Error uploading style.css: {e}", visible=True)
|