Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -13,6 +13,7 @@ from constants import css, examples, img_height, img_width, num_images_to_gen
|
|
13 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
14 |
|
15 |
from huggingface_hub import from_pretrained_keras
|
|
|
16 |
|
17 |
import requests
|
18 |
|
@@ -155,6 +156,15 @@ def update_compute_options(provider, region):
|
|
155 |
value=avalialbe_compute_options[0] if len(avalialbe_compute_options) > 0 else None
|
156 |
)
|
157 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
with gr.Blocks() as demo2:
|
160 |
gr.Markdown(
|
@@ -170,6 +180,10 @@ with gr.Blocks() as demo2:
|
|
170 |
)
|
171 |
|
172 |
providers = avaliable_providers()
|
|
|
|
|
|
|
|
|
173 |
|
174 |
with gr.Row():
|
175 |
provider_selector = gr.Dropdown(
|
@@ -188,16 +202,14 @@ with gr.Blocks() as demo2:
|
|
188 |
provider_selector.change(update_regions, inputs=provider_selector, outputs=region_selector)
|
189 |
|
190 |
with gr.Row():
|
191 |
-
repository_selector = gr.
|
192 |
-
choices=["my-funny-cat"],
|
193 |
value="my-funny-cat",
|
194 |
interactive=False,
|
195 |
label="target repository"
|
196 |
)
|
197 |
|
198 |
-
repository_selector = gr.
|
199 |
-
|
200 |
-
value="v1673257770",
|
201 |
interactive=False,
|
202 |
label="model version(branch)"
|
203 |
)
|
|
|
13 |
from share_btn import community_icon_html, loading_icon_html, share_js
|
14 |
|
15 |
from huggingface_hub import from_pretrained_keras
|
16 |
+
from huggingface_hub import Repository
|
17 |
|
18 |
import requests
|
19 |
|
|
|
156 |
value=avalialbe_compute_options[0] if len(avalialbe_compute_options) > 0 else None
|
157 |
)
|
158 |
|
159 |
+
def get_sha_of_branch(model_id, branch_name):
|
160 |
+
repo = Repository(
|
161 |
+
local_dir=model_id,
|
162 |
+
clone_from=model_id,
|
163 |
+
repo_type="model",
|
164 |
+
skip_lfs_files=True,
|
165 |
+
revision=branch_name)
|
166 |
+
|
167 |
+
return repo.git_head_hash()
|
168 |
|
169 |
with gr.Blocks() as demo2:
|
170 |
gr.Markdown(
|
|
|
180 |
)
|
181 |
|
182 |
providers = avaliable_providers()
|
183 |
+
head_sha = get_sha_of_branch(
|
184 |
+
"chansung/my-funny-cat",
|
185 |
+
"v1673257770"
|
186 |
+
)
|
187 |
|
188 |
with gr.Row():
|
189 |
provider_selector = gr.Dropdown(
|
|
|
202 |
provider_selector.change(update_regions, inputs=provider_selector, outputs=region_selector)
|
203 |
|
204 |
with gr.Row():
|
205 |
+
repository_selector = gr.Textbox(
|
|
|
206 |
value="my-funny-cat",
|
207 |
interactive=False,
|
208 |
label="target repository"
|
209 |
)
|
210 |
|
211 |
+
repository_selector = gr.Textbox(
|
212 |
+
value=f"v1673257770/{head_sha[:7]}",
|
|
|
213 |
interactive=False,
|
214 |
label="model version(branch)"
|
215 |
)
|