unclemusclez commited on
Commit
41edeed
1 Parent(s): 536cde2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -26
app.py CHANGED
@@ -58,7 +58,7 @@ def regenerate_pubkey(pubkey, oauth_token: gr.OAuthToken | None):
58
  print("Ollama pubkey Generated!")
59
 
60
 
61
- def ollamafy_model(login, model_id, ollama_library_username , ollama_q_method, latest, maintainer, oauth_token: gr.OAuthToken | None):
62
  ollama_library_username: library_username | None
63
 
64
  if oauth_token.token is None:
@@ -106,7 +106,8 @@ def ollamafy_model(login, model_id, ollama_library_username , ollama_q_method, l
106
 
107
  ### Ollamafy ###
108
  model_maintainer = model_id.split('/')[-2]
109
- ollama_model_name = model_maintainer.lower() + '_' + model_name.lower()
 
110
  ollama_modelfile_name = model_name + '_modelfile'
111
  # model_path = f"{HOME}/.cache/huggingface/hub/{model_id}"
112
 
@@ -206,16 +207,16 @@ css="""/* Custom CSS to allow scrolling */
206
  """
207
  # Create Gradio interface
208
  with gr.Blocks(css=css) as demo:
209
- with gr.Row():
210
- with gr.Column(scale=1):
211
- login = gr.LoginButton(
212
- min_width=250,
213
- )
214
- with gr.Column(scale=1):
215
- generate_pubkey = gr.Button (
216
- value="Generate Pubkey",
217
- min_width=250,
218
- )
219
  model_id = HuggingfaceHubSearch(
220
  label="Hugging Face Hub Model ID",
221
  placeholder="Search for model id on Huggingface",
@@ -234,29 +235,36 @@ with gr.Blocks(css=css) as demo:
234
  label="Copy this and paste this into your Ollama profile.",
235
  )
236
 
 
 
 
 
 
237
  ollama_library_username = gr.Textbox(
238
  label="Ollama Library Username",
239
  info="Input your username from Ollama to Push this model to their Library.",
240
  )
241
 
242
- with gr.Row():
243
- with gr.Column(scale=1):
244
-
245
- latest = gr.Checkbox(
246
- value=False,
247
- label="Latest",
248
- info="Push Model to the Ollama Library with the :latest tag."
249
- )
250
 
251
- with gr.Column(scale=1):
252
- maintainer = gr.Checkbox(
253
- value=False,
254
- label="Maintainer",
255
- info="Use this option is your original repository on both Hugging Face and Ollama."
256
- )
257
 
258
  generate_pubkey.click(
259
  fn=regenerate_pubkey,
 
 
 
 
 
 
260
  )
261
 
262
  iface = gr.Interface(
@@ -265,6 +273,7 @@ with gr.Blocks(css=css) as demo:
265
  login,
266
  generate_pubkey,
267
  model_id,
 
268
  ollama_library_username,
269
  ollama_q_method,
270
  latest,
 
58
  print("Ollama pubkey Generated!")
59
 
60
 
61
+ def ollamafy_model(login, model_id, ollama_library_username , ollama_q_method, latest, maintainer, oauth_token: gr.OAuthToken | None, ollama_model_name):
62
  ollama_library_username: library_username | None
63
 
64
  if oauth_token.token is None:
 
106
 
107
  ### Ollamafy ###
108
  model_maintainer = model_id.split('/')[-2]
109
+ if ollama_model_name = None
110
+ ollama_model_name = model_maintainer.lower() + '_' + model_name.lower()
111
  ollama_modelfile_name = model_name + '_modelfile'
112
  # model_path = f"{HOME}/.cache/huggingface/hub/{model_id}"
113
 
 
207
  """
208
  # Create Gradio interface
209
  with gr.Blocks(css=css) as demo:
210
+
211
+ login = gr.LoginButton(
212
+ min_width=250,
213
+ )
214
+
215
+ generate_pubkey = gr.Button (
216
+ value="Generate Pubkey",
217
+ min_width=250,
218
+ )
219
+
220
  model_id = HuggingfaceHubSearch(
221
  label="Hugging Face Hub Model ID",
222
  placeholder="Search for model id on Huggingface",
 
235
  label="Copy this and paste this into your Ollama profile.",
236
  )
237
 
238
+ ollama_library_username = gr.Textbox(
239
+ label="Ollama Library Username",
240
+ info="Input your username from Ollama to Push this model to their Library.",
241
+ )
242
+
243
  ollama_library_username = gr.Textbox(
244
  label="Ollama Library Username",
245
  info="Input your username from Ollama to Push this model to their Library.",
246
  )
247
 
248
+ latest = gr.Checkbox(
249
+ value=False,
250
+ label="Latest",
251
+ info="Push Model to the Ollama Library with the :latest tag."
252
+ )
 
 
 
253
 
254
+ maintainer = gr.Checkbox(
255
+ value=False,
256
+ label="Maintainer",
257
+ info="Use this option is your original repository on both Hugging Face and Ollama."
258
+ )
 
259
 
260
  generate_pubkey.click(
261
  fn=regenerate_pubkey,
262
+ inputs=[
263
+ generate_pubkey
264
+ ],
265
+ outputs=[
266
+ pubkey
267
+ ],
268
  )
269
 
270
  iface = gr.Interface(
 
273
  login,
274
  generate_pubkey,
275
  model_id,
276
+ ollama_model_name,
277
  ollama_library_username,
278
  ollama_q_method,
279
  latest,