KBaba7 commited on
Commit
cf75cab
·
verified ·
1 Parent(s): 7490d0a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -214,13 +214,18 @@ def upload_to_huggingface(file_path, repo_id, token):
214
  repo_id=repo_id,
215
  )
216
  st.success(f"✅ File uploaded to Hugging Face: {repo_id}")
 
 
 
 
 
217
  except Exception as e:
218
  st.error(f"❌ Failed to upload file: {e}")
219
 
220
  st.title("🦙 LLaMA Model Quantization (llama.cpp)")
221
 
222
 
223
- selected_model = st.selectbox("Select the Hugging Face Model", models_list)
224
  hf_model_name = selected_model if selected_model else st.text_input("Enter Hugging Face Model (If not there in the above list)")
225
  f_map_type = st.selectbox("Select the GGUF conversion type", F_TYPE_MAP)
226
 
@@ -236,7 +241,10 @@ if start_button:
236
 
237
  if st.session_state.quantized_model_path:
238
  with open(st.session_state.quantized_model_path, "rb") as f:
239
- st.download_button("⬇️ Download Quantized Model", f, file_name=os.path.basename(st.session_state.quantized_model_path))
 
 
 
240
 
241
  # Checkbox for upload section
242
  st.session_state.upload_to_hf = st.checkbox("Upload to Hugging Face", value=st.session_state.upload_to_hf)
 
214
  repo_id=repo_id,
215
  )
216
  st.success(f"✅ File uploaded to Hugging Face: {repo_id}")
217
+
218
+ # Reset session state and rerun
219
+ st.session_state.quantized_model_path = None
220
+ st.session_state.upload_to_hf = False
221
+ st.rerun()
222
  except Exception as e:
223
  st.error(f"❌ Failed to upload file: {e}")
224
 
225
  st.title("🦙 LLaMA Model Quantization (llama.cpp)")
226
 
227
 
228
+ selected_model = st.selectbox("Select the Hugging Face Model", models_list, index=None)
229
  hf_model_name = selected_model if selected_model else st.text_input("Enter Hugging Face Model (If not there in the above list)")
230
  f_map_type = st.selectbox("Select the GGUF conversion type", F_TYPE_MAP)
231
 
 
241
 
242
  if st.session_state.quantized_model_path:
243
  with open(st.session_state.quantized_model_path, "rb") as f:
244
+ if st.download_button("⬇️ Download Quantized Model", f, file_name=os.path.basename(st.session_state.quantized_model_path)):
245
+ st.session_state.quantized_model_path = None
246
+ st.session_state.upload_to_hf = False
247
+ st.rerun()
248
 
249
  # Checkbox for upload section
250
  st.session_state.upload_to_hf = st.checkbox("Upload to Hugging Face", value=st.session_state.upload_to_hf)