Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -264,14 +264,8 @@ def start_training(
|
|
264 |
return f"""# Training completed successfully!
|
265 |
## Your model is available at: <a href='https://huggingface.co/{username}/{slugged_lora_name}'>{username}/{slugged_lora_name}</a>"""
|
266 |
|
267 |
-
def
|
268 |
-
# HF_TOKEN์ด ์์ผ๋ฏ๋ก ํญ์ ๋ก๊ทธ์ธ๋ ์ํ๋ก ์ฒ๋ฆฌ
|
269 |
-
return gr.update(elem_classes=["main_ui_logged_in"])
|
270 |
-
|
271 |
-
def update_pricing(steps, oauth_token: Union[gr.OAuthToken, None]):
|
272 |
-
# HF_TOKEN์ ์ฌ์ฉํ์ฌ ์ง์ ํ์ธ
|
273 |
try:
|
274 |
-
user = whoami()
|
275 |
seconds_per_iteration = 7.54
|
276 |
total_seconds = (steps * seconds_per_iteration) + 240
|
277 |
cost_per_second = 0.80/60/60
|
@@ -281,7 +275,7 @@ def update_pricing(steps, oauth_token: Union[gr.OAuthToken, None]):
|
|
281 |
return gr.update(visible=True), cost_preview, gr.update(visible=False), gr.update(visible=True)
|
282 |
except:
|
283 |
return gr.update(visible=False), "", gr.update(visible=False), gr.update(visible=True)
|
284 |
-
|
285 |
|
286 |
|
287 |
def swap_base_model(model):
|
@@ -346,8 +340,10 @@ with gr.Blocks(theme=theme, css=css) as demo:
|
|
346 |
"""# ๐ Gini LoRA ํ์ต
|
347 |
### ์ด๋ฏธ์ง๋ค(์ต๋ 150์ฅ ์๋)์ ์
๋ก๋ํ์ธ์. """
|
348 |
)
|
349 |
-
|
350 |
-
|
|
|
|
|
351 |
|
352 |
with gr.Group():
|
353 |
with gr.Row():
|
@@ -506,38 +502,33 @@ with gr.Blocks(theme=theme, css=css) as demo:
|
|
506 |
)
|
507 |
|
508 |
gr.on(
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
sample_1,
|
531 |
-
sample_2,
|
532 |
-
sample_3,
|
533 |
-
use_more_advanced_options,
|
534 |
-
more_advanced_options
|
535 |
],
|
536 |
-
|
537 |
-
|
|
|
|
|
538 |
|
539 |
-
do_captioning.click(fn=run_captioning, inputs=[images, concept_sentence] + caption_list, outputs=caption_list)
|
540 |
-
demo.load(fn=swap_visibilty, outputs=main_ui)
|
541 |
|
542 |
if __name__ == "__main__":
|
543 |
demo.launch(
|
|
|
264 |
return f"""# Training completed successfully!
|
265 |
## Your model is available at: <a href='https://huggingface.co/{username}/{slugged_lora_name}'>{username}/{slugged_lora_name}</a>"""
|
266 |
|
267 |
+
def update_pricing(steps):
|
|
|
|
|
|
|
|
|
|
|
268 |
try:
|
|
|
269 |
seconds_per_iteration = 7.54
|
270 |
total_seconds = (steps * seconds_per_iteration) + 240
|
271 |
cost_per_second = 0.80/60/60
|
|
|
275 |
return gr.update(visible=True), cost_preview, gr.update(visible=False), gr.update(visible=True)
|
276 |
except:
|
277 |
return gr.update(visible=False), "", gr.update(visible=False), gr.update(visible=True)
|
278 |
+
|
279 |
|
280 |
|
281 |
def swap_base_model(model):
|
|
|
340 |
"""# ๐ Gini LoRA ํ์ต
|
341 |
### ์ด๋ฏธ์ง๋ค(์ต๋ 150์ฅ ์๋)์ ์
๋ก๋ํ์ธ์. """
|
342 |
)
|
343 |
+
|
344 |
+
with gr.Tab("Train"): # ํญ ์ด๋ฆ ๋ณ๊ฒฝ
|
345 |
+
with gr.Column(): # main_ui ๋์ ์ง์ Column ์ฌ์ฉ
|
346 |
+
with gr.Group():
|
347 |
|
348 |
with gr.Group():
|
349 |
with gr.Row():
|
|
|
502 |
)
|
503 |
|
504 |
gr.on(
|
505 |
+
triggers=[steps.change],
|
506 |
+
fn=update_pricing,
|
507 |
+
inputs=[steps],
|
508 |
+
outputs=[cost_preview, cost_preview_info, payment_update, start]
|
509 |
+
)
|
510 |
+
|
511 |
+
start.click(fn=create_dataset, inputs=[images] + caption_list, outputs=dataset_folder).then(
|
512 |
+
fn=start_training,
|
513 |
+
inputs=[
|
514 |
+
lora_name,
|
515 |
+
concept_sentence,
|
516 |
+
which_model,
|
517 |
+
steps,
|
518 |
+
lr,
|
519 |
+
rank,
|
520 |
+
dataset_folder,
|
521 |
+
sample_1,
|
522 |
+
sample_2,
|
523 |
+
sample_3,
|
524 |
+
use_more_advanced_options,
|
525 |
+
more_advanced_options
|
|
|
|
|
|
|
|
|
|
|
526 |
],
|
527 |
+
outputs=progress_area,
|
528 |
+
)
|
529 |
+
|
530 |
+
do_captioning.click(fn=run_captioning, inputs=[images, concept_sentence] + caption_list, outputs=caption_list)
|
531 |
|
|
|
|
|
532 |
|
533 |
if __name__ == "__main__":
|
534 |
demo.launch(
|