hysts
commited on
Commit
·
643c51e
1
Parent(s):
547c2d3
Remove user name from space name
Browse files
app.py
CHANGED
@@ -20,15 +20,15 @@ If you specify multiple model names, the resulting Space will show all the outpu
|
|
20 |
article = ''
|
21 |
examples = [
|
22 |
[
|
|
|
|
|
23 |
'',
|
24 |
-
'
|
25 |
-
'',
|
26 |
-
'Demo for google/vit-base-patch16-224',
|
27 |
'',
|
28 |
'',
|
29 |
],
|
30 |
[
|
31 |
-
'',
|
32 |
'google/vit-base-patch16-224, microsoft/resnet-50',
|
33 |
'',
|
34 |
'Compare Image Classification Models',
|
@@ -36,7 +36,7 @@ examples = [
|
|
36 |
'',
|
37 |
],
|
38 |
[
|
39 |
-
'',
|
40 |
'EleutherAI/gpt-j-6B, EleutherAI/gpt-neo-1.3B',
|
41 |
'',
|
42 |
'Compare Text Generation Models',
|
@@ -115,8 +115,10 @@ def run(space_name: str, model_names_str: str, hf_token: str, title: str,
|
|
115 |
if not check_if_model_io_is_consistent(model_names):
|
116 |
return 'The inputs and outputs of each model must be the same.'
|
117 |
|
|
|
|
|
118 |
try:
|
119 |
-
space_url = api.create_repo(repo_id=
|
120 |
repo_type='space',
|
121 |
private=True,
|
122 |
token=hf_token,
|
@@ -130,7 +132,7 @@ def run(space_name: str, model_names_str: str, hf_token: str, title: str,
|
|
130 |
save_space_info(temp_dir, 'DESCRIPTION', description)
|
131 |
save_space_info(temp_dir, 'ARTICLE', article)
|
132 |
save_space_info(temp_dir, 'MODEL_NAMES', model_names_str)
|
133 |
-
api.upload_folder(repo_id=
|
134 |
folder_path=temp_dir,
|
135 |
path_in_repo='.',
|
136 |
token=hf_token,
|
@@ -142,7 +144,11 @@ def run(space_name: str, model_names_str: str, hf_token: str, title: str,
|
|
142 |
gr.Interface(
|
143 |
fn=run,
|
144 |
inputs=[
|
145 |
-
gr.Textbox(
|
|
|
|
|
|
|
|
|
146 |
gr.Textbox(label='Model Names',
|
147 |
placeholder='e.g. microsoft/resnet-50'),
|
148 |
gr.Textbox(
|
|
|
20 |
article = ''
|
21 |
examples = [
|
22 |
[
|
23 |
+
'resnet-50',
|
24 |
+
'microsoft/resnet-50',
|
25 |
'',
|
26 |
+
'Demo for microsoft/resnet-50',
|
|
|
|
|
27 |
'',
|
28 |
'',
|
29 |
],
|
30 |
[
|
31 |
+
'compare-image-classification-models',
|
32 |
'google/vit-base-patch16-224, microsoft/resnet-50',
|
33 |
'',
|
34 |
'Compare Image Classification Models',
|
|
|
36 |
'',
|
37 |
],
|
38 |
[
|
39 |
+
'compare-text-generation-models',
|
40 |
'EleutherAI/gpt-j-6B, EleutherAI/gpt-neo-1.3B',
|
41 |
'',
|
42 |
'Compare Text Generation Models',
|
|
|
115 |
if not check_if_model_io_is_consistent(model_names):
|
116 |
return 'The inputs and outputs of each model must be the same.'
|
117 |
|
118 |
+
user_name = api.whoami(token=hf_token)['name']
|
119 |
+
repo_id = f'{user_name}/{space_name}'
|
120 |
try:
|
121 |
+
space_url = api.create_repo(repo_id=repo_id,
|
122 |
repo_type='space',
|
123 |
private=True,
|
124 |
token=hf_token,
|
|
|
132 |
save_space_info(temp_dir, 'DESCRIPTION', description)
|
133 |
save_space_info(temp_dir, 'ARTICLE', article)
|
134 |
save_space_info(temp_dir, 'MODEL_NAMES', model_names_str)
|
135 |
+
api.upload_folder(repo_id=repo_id,
|
136 |
folder_path=temp_dir,
|
137 |
path_in_repo='.',
|
138 |
token=hf_token,
|
|
|
144 |
gr.Interface(
|
145 |
fn=run,
|
146 |
inputs=[
|
147 |
+
gr.Textbox(
|
148 |
+
label='Space Name',
|
149 |
+
placeholder=
|
150 |
+
'e.g. demo-resnet-50. The Space will be created under your account and private.'
|
151 |
+
),
|
152 |
gr.Textbox(label='Model Names',
|
153 |
placeholder='e.g. microsoft/resnet-50'),
|
154 |
gr.Textbox(
|