Spaces:
Runtime error
Runtime error
Commit
Β·
aa5f18f
1
Parent(s):
3185c51
Update filesystem shell commands
Browse files
app.py
CHANGED
@@ -39,6 +39,7 @@ from IPython.display import Markdown
|
|
39 |
from huggingface_hub import hf_hub_download
|
40 |
|
41 |
#@title Concept Pipe Function
|
|
|
42 |
|
43 |
def create_concept_pipe(model_name):
|
44 |
# 1. Load Concept
|
@@ -53,12 +54,24 @@ def create_concept_pipe(model_name):
|
|
53 |
if(not embeds_url):
|
54 |
embeds_path = hf_hub_download(repo_id=repo_id_embeds, filename="learned_embeds.bin")
|
55 |
token_path = hf_hub_download(repo_id=repo_id_embeds, filename="token_identifier.txt")
|
56 |
-
|
57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
with open(f'{downloaded_embedding_folder}/token_identifier.txt', 'r') as file:
|
59 |
placeholder_token_string = file.read()
|
60 |
else:
|
61 |
-
|
|
|
|
|
|
|
|
|
|
|
62 |
|
63 |
learned_embeds_path = f"{downloaded_embedding_folder}/learned_embeds.bin"
|
64 |
|
@@ -268,4 +281,4 @@ with gr.Blocks(css=".gradio-container {max-width: 650px}") as demo:
|
|
268 |
#@title Create Gradio Tab Interface
|
269 |
|
270 |
tabbed_interface = gr.TabbedInterface([demo], ["Concept Loader"])
|
271 |
-
tabbed_interface.launch(
|
|
|
39 |
from huggingface_hub import hf_hub_download
|
40 |
|
41 |
#@title Concept Pipe Function
|
42 |
+
import subprocess
|
43 |
|
44 |
def create_concept_pipe(model_name):
|
45 |
# 1. Load Concept
|
|
|
54 |
if(not embeds_url):
|
55 |
embeds_path = hf_hub_download(repo_id=repo_id_embeds, filename="learned_embeds.bin")
|
56 |
token_path = hf_hub_download(repo_id=repo_id_embeds, filename="token_identifier.txt")
|
57 |
+
# FOR DEPLOYMENT: address file system use
|
58 |
+
#!cp downloaded_embedding_folder
|
59 |
+
#!cp downloaded_embedding_folder
|
60 |
+
|
61 |
+
# UNDER CONSTRUCTION ---{{{
|
62 |
+
subprocess.call([f"cp {embeds_path} {downloaded_embedding_folder}"])
|
63 |
+
subprocess.call([f"cp {token_path} {downloaded_embedding_folder}"])
|
64 |
+
# }}}---
|
65 |
+
|
66 |
with open(f'{downloaded_embedding_folder}/token_identifier.txt', 'r') as file:
|
67 |
placeholder_token_string = file.read()
|
68 |
else:
|
69 |
+
# FOR DEPLOYMENT: address file system use
|
70 |
+
#!wget -q -O $downloaded_embedding_folder/learned_embeds.bin $embeds_url
|
71 |
+
|
72 |
+
# UNDER CONSTRUCTION ---{{{
|
73 |
+
subprocess.call([f"wget -q -O {downloaded_embedding_folder}/learned_embeds.bin {embeds_url}"])
|
74 |
+
# }}}---
|
75 |
|
76 |
learned_embeds_path = f"{downloaded_embedding_folder}/learned_embeds.bin"
|
77 |
|
|
|
281 |
#@title Create Gradio Tab Interface
|
282 |
|
283 |
tabbed_interface = gr.TabbedInterface([demo], ["Concept Loader"])
|
284 |
+
tabbed_interface.launch()
|