Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -26,15 +26,16 @@ download_gguf_link = None
|
|
26 |
def regenerate_pubkey(pubkey, oauth_token: gr.OAuthToken | None):
|
27 |
if oauth_token.token is None:
|
28 |
raise ValueError("You must be logged in to use Ollamafy")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
try:
|
30 |
-
hash_oauth = hashlib.sha256(oauth_token).hexdigest()
|
31 |
-
generate_ollama_host_file = f"echo $(ss -natp | grep (cat ollama.pid) | awk '{{print $4}}') > ollama.host"
|
32 |
-
generate_ollama_pid_file = f"echo $! > ollama.pid"
|
33 |
-
ollama_pubkey = f"cat {HOME}/{hash_oauth}/.ollama/id_ed25519.pub"
|
34 |
-
ollama_start = f"HOME={HOME}/{hash_oauth} ollama serve & {generate_ollama_pid_file} & sleep 5 & {generate_ollama_host_file}"
|
35 |
-
ollama_stop = f"kill -9 'cat ${HOME}/{hash_oauth}/ollama.pid'"
|
36 |
-
delete_home = f"rm -Rf {HOME}/{hash_oauth}/.ollama"
|
37 |
-
|
38 |
result = subprocess.run(ollama_stop, shell=True, capture_output=True)
|
39 |
print(result)
|
40 |
if result.returncode != 0:
|
|
|
26 |
def regenerate_pubkey(pubkey, oauth_token: gr.OAuthToken | None):
|
27 |
if oauth_token.token is None:
|
28 |
raise ValueError("You must be logged in to use Ollamafy")
|
29 |
+
|
30 |
+
hash_oauth = hashlib.sha256(oauth_token).hexdigest()
|
31 |
+
generate_ollama_host_file = f"echo $(ss -natp | grep (cat ollama.pid) | awk '{{print $4}}') > ollama.host"
|
32 |
+
generate_ollama_pid_file = f"echo $! > ollama.pid"
|
33 |
+
ollama_pubkey = f"cat {HOME}/{hash_oauth}/.ollama/id_ed25519.pub"
|
34 |
+
ollama_start = f"HOME={HOME}/{hash_oauth} ollama serve & {generate_ollama_pid_file} & sleep 5 & {generate_ollama_host_file}"
|
35 |
+
ollama_stop = f"kill -9 'cat ${HOME}/{hash_oauth}/ollama.pid'"
|
36 |
+
delete_home = f"rm -Rf {HOME}/{hash_oauth}/.ollama"
|
37 |
+
|
38 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
result = subprocess.run(ollama_stop, shell=True, capture_output=True)
|
40 |
print(result)
|
41 |
if result.returncode != 0:
|