Spaces:
Running
Running
Update tabs/download/download.py
Browse files- tabs/download/download.py +1 -37
tabs/download/download.py
CHANGED
@@ -58,27 +58,6 @@ def save_drop_model(dropbox):
|
|
58 |
return None
|
59 |
|
60 |
|
61 |
-
def search_models(name):
|
62 |
-
url = f"https://cjtfqzjfdimgpvpwhzlv.supabase.co/rest/v1/models?name=ilike.%25{name}%25&order=created_at.desc&limit=15"
|
63 |
-
headers = {
|
64 |
-
"apikey": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImNqdGZxempmZGltZ3B2cHdoemx2Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3MjY5MjYxMzQsImV4cCI6MjA0MjUwMjEzNH0.OyDXlhvH6D-IsHiWhPAGUtsPGGUvWQynfxUeQwfYToE"
|
65 |
-
}
|
66 |
-
response = requests.get(url, headers=headers)
|
67 |
-
data = response.json()
|
68 |
-
if len(data) == 0:
|
69 |
-
gr.Info(i18n("We couldn't find models by that name."))
|
70 |
-
return None
|
71 |
-
else:
|
72 |
-
df = pd.DataFrame(data)[["name", "link", "epochs", "type"]]
|
73 |
-
df["link"] = df["link"].apply(
|
74 |
-
lambda x: f'<a href="{x}" target="_blank">{x}</a>'
|
75 |
-
)
|
76 |
-
return df
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
def get_file_size(url):
|
83 |
response = requests.head(url)
|
84 |
return int(response.headers.get("content-length", 0))
|
@@ -127,19 +106,4 @@ def download_tab():
|
|
127 |
fn=save_drop_model,
|
128 |
inputs=[dropbox],
|
129 |
outputs=[dropbox],
|
130 |
-
)
|
131 |
-
gr.Markdown(value=i18n("## Search Model"))
|
132 |
-
search_name = gr.Textbox(
|
133 |
-
label=i18n("Model Name"),
|
134 |
-
placeholder=i18n("Introduce the model name to search."),
|
135 |
-
interactive=True,
|
136 |
-
)
|
137 |
-
search_table = gr.Dataframe(datatype="markdown")
|
138 |
-
search = gr.Button(i18n("Search"))
|
139 |
-
search.click(
|
140 |
-
fn=search_models,
|
141 |
-
inputs=[search_name],
|
142 |
-
outputs=[search_table],
|
143 |
-
)
|
144 |
-
search_name.submit(search_models, [search_name], search_table)
|
145 |
-
|
|
|
58 |
return None
|
59 |
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
def get_file_size(url):
|
62 |
response = requests.head(url)
|
63 |
return int(response.headers.get("content-length", 0))
|
|
|
106 |
fn=save_drop_model,
|
107 |
inputs=[dropbox],
|
108 |
outputs=[dropbox],
|
109 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|