Spaces:
Running
Running
Cleanup
Browse files
app.py
CHANGED
@@ -1,21 +1,17 @@
|
|
1 |
import os
|
2 |
-
import shutil
|
3 |
import tempfile
|
4 |
|
5 |
os.environ["HF_HUB_CACHE"] = "cache"
|
6 |
os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
|
7 |
import gradio as gr
|
8 |
|
9 |
-
from huggingface_hub import
|
10 |
-
from huggingface_hub import snapshot_download
|
11 |
from huggingface_hub import whoami
|
12 |
from huggingface_hub import ModelCard
|
13 |
-
from huggingface_hub import login
|
14 |
from huggingface_hub import scan_cache_dir
|
15 |
from huggingface_hub import logging
|
16 |
|
17 |
from gradio_huggingfacehub_search import HuggingfaceHubSearch
|
18 |
-
|
19 |
from apscheduler.schedulers.background import BackgroundScheduler
|
20 |
|
21 |
from textwrap import dedent
|
@@ -23,8 +19,6 @@ from textwrap import dedent
|
|
23 |
import mlx_lm
|
24 |
from mlx_lm import convert
|
25 |
|
26 |
-
from typing import Any, Callable, Dict, Generator, List, Optional, Tuple, Type, Union
|
27 |
-
|
28 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
29 |
|
30 |
def clear_hf_cache_space():
|
@@ -84,8 +78,7 @@ def upload_to_hub(path, upload_repo, hf_path, token):
|
|
84 |
)
|
85 |
print(f"Upload successful, go to https://huggingface.co/{upload_repo} for details.")
|
86 |
|
87 |
-
def process_model(model_id, q_method,oauth_token: gr.OAuthToken | None):
|
88 |
-
|
89 |
if oauth_token.token is None:
|
90 |
raise ValueError("You must be logged in to use MLX-my-repo")
|
91 |
|
@@ -93,8 +86,6 @@ def process_model(model_id, q_method,oauth_token: gr.OAuthToken | None):
|
|
93 |
print(model_name)
|
94 |
username = whoami(oauth_token.token)["name"]
|
95 |
print(username)
|
96 |
-
|
97 |
-
# login(token=oauth_token.token, add_to_git_credential=True)
|
98 |
|
99 |
try:
|
100 |
upload_repo = username + "/" + model_name + "-mlx"
|
|
|
1 |
import os
|
|
|
2 |
import tempfile
|
3 |
|
4 |
os.environ["HF_HUB_CACHE"] = "cache"
|
5 |
os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
|
6 |
import gradio as gr
|
7 |
|
8 |
+
from huggingface_hub import HfApi
|
|
|
9 |
from huggingface_hub import whoami
|
10 |
from huggingface_hub import ModelCard
|
|
|
11 |
from huggingface_hub import scan_cache_dir
|
12 |
from huggingface_hub import logging
|
13 |
|
14 |
from gradio_huggingfacehub_search import HuggingfaceHubSearch
|
|
|
15 |
from apscheduler.schedulers.background import BackgroundScheduler
|
16 |
|
17 |
from textwrap import dedent
|
|
|
19 |
import mlx_lm
|
20 |
from mlx_lm import convert
|
21 |
|
|
|
|
|
22 |
HF_TOKEN = os.environ.get("HF_TOKEN")
|
23 |
|
24 |
def clear_hf_cache_space():
|
|
|
78 |
)
|
79 |
print(f"Upload successful, go to https://huggingface.co/{upload_repo} for details.")
|
80 |
|
81 |
+
def process_model(model_id, q_method, oauth_token: gr.OAuthToken | None):
|
|
|
82 |
if oauth_token.token is None:
|
83 |
raise ValueError("You must be logged in to use MLX-my-repo")
|
84 |
|
|
|
86 |
print(model_name)
|
87 |
username = whoami(oauth_token.token)["name"]
|
88 |
print(username)
|
|
|
|
|
89 |
|
90 |
try:
|
91 |
upload_repo = username + "/" + model_name + "-mlx"
|