unclemusclez commited on
Commit
6f8fbc7
·
verified ·
1 Parent(s): df1dbc1

auth_token and cat ollama_pubkey

Browse files

TypeError: regenerate_pubkey() missing 1 required positional argument: 'auth_token'

Files changed (1) hide show
  1. app.py +2 -3
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 = open(f"{HOME}/.ollama/{hash_oauth}/id_ed25519.pub", "r")
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.read().rstrip(),
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()