Spaces:
Running
Running
Update maker.py
Browse files
maker.py
CHANGED
|
@@ -3,6 +3,7 @@ import requests
|
|
| 3 |
import json
|
| 4 |
import huggingface_hub
|
| 5 |
from huggingface_hub import HfApi
|
|
|
|
| 6 |
|
| 7 |
HF_TOKEN = "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"
|
| 8 |
HEADERS = {"Authorization": f"Bearer {HF_TOKEN}"}
|
|
@@ -155,10 +156,10 @@ def publish(textbox_system_prompt, textbox_title, textbox_example, textbox_token
|
|
| 155 |
original_content = file.read()
|
| 156 |
with open(destination_file, 'w') as file:
|
| 157 |
file.write(constants_formatted + original_content)
|
| 158 |
-
|
| 159 |
api = HfApi(token=textbox_token)
|
| 160 |
new_space = api.create_repo(
|
| 161 |
-
repo_id=f"open-gpt-{
|
| 162 |
repo_type="space",
|
| 163 |
exist_ok=True,
|
| 164 |
private=False,
|
|
|
|
| 3 |
import json
|
| 4 |
import huggingface_hub
|
| 5 |
from huggingface_hub import HfApi
|
| 6 |
+
from gradio_client.utils import strip_invalid_filename_characters
|
| 7 |
|
| 8 |
HF_TOKEN = "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"
|
| 9 |
HEADERS = {"Authorization": f"Bearer {HF_TOKEN}"}
|
|
|
|
| 156 |
original_content = file.read()
|
| 157 |
with open(destination_file, 'w') as file:
|
| 158 |
file.write(constants_formatted + original_content)
|
| 159 |
+
title = strip_invalid_filename_characters(textbox_title, max_bytes=30)
|
| 160 |
api = HfApi(token=textbox_token)
|
| 161 |
new_space = api.create_repo(
|
| 162 |
+
repo_id=f"open-gpt-{title}",
|
| 163 |
repo_type="space",
|
| 164 |
exist_ok=True,
|
| 165 |
private=False,
|