Spaces:
Runtime error
Runtime error
auth_token and cat ollama_pubkey
Browse filesTypeError: regenerate_pubkey() missing 1 required positional argument: 'auth_token'
app.py
CHANGED
@@ -27,7 +27,7 @@ def regenerate_pubkey(auth_token: gr.OAuthToken | None):
|
|
27 |
hash_oauth = hashlib.sha256(unicode_string.encode(oauth_token)).hexdigest()
|
28 |
ollama_host_file = f"echo $(ss -natp | grep (cat ollama.pid) | awk '{{print $4}}') > ollama.host"
|
29 |
ollama_pid_file = f"echo $! > ollama.pid"
|
30 |
-
ollama_pubkey =
|
31 |
ollama_start = f"HOME={HOME}/{hash_oauth} ollama serve & {ollama_pid_file} & sleep 5 & {ollama_host_file}"
|
32 |
ollama_stop = f"kill -9 'cat ${HOME}/{hash_oauth}/ollama.pid'"
|
33 |
delete_home = f"rm -Rf {HOME}/{hash_oauth}/.ollama"
|
@@ -214,7 +214,7 @@ with gr.Blocks(css=css) as demo:
|
|
214 |
)
|
215 |
|
216 |
account = gr.Code (
|
217 |
-
ollama_pubkey
|
218 |
label="Ollama SSH pubkey",
|
219 |
# info="Copy this and paste it into your Ollama profile.",
|
220 |
)
|
@@ -262,7 +262,6 @@ with gr.Blocks(css=css) as demo:
|
|
262 |
)
|
263 |
|
264 |
def restart_space():
|
265 |
-
ollama_pubkey.close(),
|
266 |
HfApi().restart_space(repo_id="unclemusclez/ollamafy", token=HF_TOKEN, library_username=OLLAMA_USERNAME, factory_reboot=True)
|
267 |
|
268 |
scheduler = BackgroundScheduler()
|
|
|
27 |
hash_oauth = hashlib.sha256(unicode_string.encode(oauth_token)).hexdigest()
|
28 |
ollama_host_file = f"echo $(ss -natp | grep (cat ollama.pid) | awk '{{print $4}}') > ollama.host"
|
29 |
ollama_pid_file = f"echo $! > ollama.pid"
|
30 |
+
ollama_pubkey = f"cat {HOME}/.ollama/{hash_oauth}/id_ed25519.pub")
|
31 |
ollama_start = f"HOME={HOME}/{hash_oauth} ollama serve & {ollama_pid_file} & sleep 5 & {ollama_host_file}"
|
32 |
ollama_stop = f"kill -9 'cat ${HOME}/{hash_oauth}/ollama.pid'"
|
33 |
delete_home = f"rm -Rf {HOME}/{hash_oauth}/.ollama"
|
|
|
214 |
)
|
215 |
|
216 |
account = gr.Code (
|
217 |
+
ollama_pubkey,
|
218 |
label="Ollama SSH pubkey",
|
219 |
# info="Copy this and paste it into your Ollama profile.",
|
220 |
)
|
|
|
262 |
)
|
263 |
|
264 |
def restart_space():
|
|
|
265 |
HfApi().restart_space(repo_id="unclemusclez/ollamafy", token=HF_TOKEN, library_username=OLLAMA_USERNAME, factory_reboot=True)
|
266 |
|
267 |
scheduler = BackgroundScheduler()
|