Spaces:
Runtime error
Runtime error
fix git push with OLLAMA_HOST={ollama_host} ollama push
Browse filesSyntaxError: unmatched ')'
File "/app/app.py", line 30
ollama_pubkey = f"cat {HOME}/.ollama/{hash_oauth}/id_ed25519.pub")
^
SyntaxError: unmatched ')'
app.py
CHANGED
@@ -25,12 +25,8 @@ def regenerate_pubkey(auth_token: gr.OAuthToken | None):
|
|
25 |
if oauth_token.token is None:
|
26 |
raise ValueError("You must be logged in to use Ollamafy")
|
27 |
hash_oauth = hashlib.sha256(unicode_string.encode(oauth_token)).hexdigest()
|
28 |
-
|
29 |
-
|
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"
|
34 |
|
35 |
result = subprocess.run(ollama_stop, shell=True, capture_output=True)
|
36 |
print(result)
|
@@ -127,10 +123,10 @@ def ollamafy_model(login, account, model_id, ollama_library_username , ollama_q_
|
|
127 |
print("Model converted to Ollama successfully!")
|
128 |
|
129 |
if maintainer:
|
130 |
-
ollama_push = f"
|
131 |
ollama_rm = f"ollama rm {library_username}/{model_name}:{q_method.lower()}"
|
132 |
else:
|
133 |
-
ollama_push = f"
|
134 |
ollama_rm = f"ollama rm {library_username}/{ollama_model_name}:{q_method.lower()}"
|
135 |
|
136 |
ollama_push_result = subprocess.run(ollama_push, shell=True, capture_output=True)
|
@@ -157,10 +153,10 @@ def ollamafy_model(login, account, model_id, ollama_library_username , ollama_q_
|
|
157 |
print("Model pushed to Ollama library successfully!")
|
158 |
|
159 |
if maintainer:
|
160 |
-
ollama_push_latest = f"
|
161 |
ollama_rm_latest = f"ollama rm {library_username}/{model_name}:latest"
|
162 |
else:
|
163 |
-
ollama_push_latest = f"
|
164 |
ollama_rm_latest = f"ollama rm {library_username}/{ollama_model_name}:latest"
|
165 |
|
166 |
ollama_push_latest_result = subprocess.run(ollama_push_latest, shell=True, capture_output=True)
|
@@ -221,7 +217,7 @@ with gr.Blocks(css=css) as demo:
|
|
221 |
|
222 |
ollama_library_username = gr.Textbox(
|
223 |
label="Ollama Library Username",
|
224 |
-
info="Input your username from Ollama to
|
225 |
)
|
226 |
|
227 |
with gr.Row():
|
|
|
25 |
if oauth_token.token is None:
|
26 |
raise ValueError("You must be logged in to use Ollamafy")
|
27 |
hash_oauth = hashlib.sha256(unicode_string.encode(oauth_token)).hexdigest()
|
28 |
+
generate_ollama_host_file = f"echo $(ss -natp | grep (cat ollama.pid) | awk '{{print $4}}') > ollama.host"
|
29 |
+
generate_ollama_pid_file = f"echo $! > ollama.pid"
|
|
|
|
|
|
|
|
|
30 |
|
31 |
result = subprocess.run(ollama_stop, shell=True, capture_output=True)
|
32 |
print(result)
|
|
|
123 |
print("Model converted to Ollama successfully!")
|
124 |
|
125 |
if maintainer:
|
126 |
+
ollama_push = f"OLLAMA_HOST={ollama_host} ollama {library_username}/{model_name}:{q_method.lower()}"
|
127 |
ollama_rm = f"ollama rm {library_username}/{model_name}:{q_method.lower()}"
|
128 |
else:
|
129 |
+
ollama_push = f"OLLAMA_HOST={ollama_host} ollama push {library_username}/{ollama_model_name}:{q_method.lower()}"
|
130 |
ollama_rm = f"ollama rm {library_username}/{ollama_model_name}:{q_method.lower()}"
|
131 |
|
132 |
ollama_push_result = subprocess.run(ollama_push, shell=True, capture_output=True)
|
|
|
153 |
print("Model pushed to Ollama library successfully!")
|
154 |
|
155 |
if maintainer:
|
156 |
+
ollama_push_latest = f"OLLAMA_HOST={ollama_host} ollama push {library_username}/{model_name}:latest"
|
157 |
ollama_rm_latest = f"ollama rm {library_username}/{model_name}:latest"
|
158 |
else:
|
159 |
+
ollama_push_latest = f"OLLAMA_HOST={ollama_host} ollama push {library_username}/{ollama_model_name}:latest"
|
160 |
ollama_rm_latest = f"ollama rm {library_username}/{ollama_model_name}:latest"
|
161 |
|
162 |
ollama_push_latest_result = subprocess.run(ollama_push_latest, shell=True, capture_output=True)
|
|
|
217 |
|
218 |
ollama_library_username = gr.Textbox(
|
219 |
label="Ollama Library Username",
|
220 |
+
info="Input your username from Ollama to Push this model to their Library.",
|
221 |
)
|
222 |
|
223 |
with gr.Row():
|