Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,7 @@ import shutil
|
|
5 |
import requests
|
6 |
import subprocess
|
7 |
from subprocess import getoutput
|
|
|
8 |
from huggingface_hub import snapshot_download, HfApi, create_repo
|
9 |
|
10 |
api = HfApi()
|
@@ -185,9 +186,12 @@ def main(image_path, b_lora_trained_folder, instance_prompt, training_type, trai
|
|
185 |
if instance_prompt == "":
|
186 |
raise gr.Error("You forgot to specify an instance prompt")
|
187 |
|
188 |
-
#
|
189 |
-
|
190 |
-
|
|
|
|
|
|
|
191 |
|
192 |
local_dir = "image_to_train"
|
193 |
# Check if the directory exists and create it if necessary
|
@@ -211,6 +215,12 @@ def main(image_path, b_lora_trained_folder, instance_prompt, training_type, trai
|
|
211 |
|
212 |
your_username = api.whoami(token=hf_token)["name"]
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
#swap_hardware(hardware="cpu-basic")
|
215 |
swap_sleep_time(300)
|
216 |
|
|
|
5 |
import requests
|
6 |
import subprocess
|
7 |
from subprocess import getoutput
|
8 |
+
import webbrowser
|
9 |
from huggingface_hub import snapshot_download, HfApi, create_repo
|
10 |
|
11 |
api = HfApi()
|
|
|
186 |
if instance_prompt == "":
|
187 |
raise gr.Error("You forgot to specify an instance prompt")
|
188 |
|
189 |
+
# URL to be opened
|
190 |
+
log_url = f"https://huggingface.co/spaces/{os.environ['SPACE_ID']}?logs=container"
|
191 |
+
|
192 |
+
# Open URL in the current browser window
|
193 |
+
webbrowser.open(log_url)
|
194 |
+
|
195 |
|
196 |
local_dir = "image_to_train"
|
197 |
# Check if the directory exists and create it if necessary
|
|
|
215 |
|
216 |
your_username = api.whoami(token=hf_token)["name"]
|
217 |
|
218 |
+
# URL to be opened
|
219 |
+
model_url = f"https://huggingface.co/{your_username}/{b_lora_trained_folder}"
|
220 |
+
|
221 |
+
# Open URL in the current browser window
|
222 |
+
webbrowser.open_new_tab(model_url)
|
223 |
+
|
224 |
#swap_hardware(hardware="cpu-basic")
|
225 |
swap_sleep_time(300)
|
226 |
|