Aditya commited on
Commit
868a905
·
1 Parent(s): 09c4e61

Prepare for Hugging Face Spaces deployment

Browse files

- Add HF Space YAML frontmatter to README.md (Streamlit SDK)
- Update demo.py: check checkpoint-25/ (committed) instead of
finetuned_model/ (gitignored) so Fine-Tuned works on HF Spaces
- Update spinner message for first-run base model download

Files changed (2) hide show
  1. README.md +11 -0
  2. demo.py +4 -5
README.md CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  # CodeSage — LLM vs RAG vs Fine-Tuning
2
 
3
  > A live comparative study of three NLP architectures for domain-specific Q&A, built with Streamlit.
 
1
+ ---
2
+ title: CodeSage
3
+ emoji: 🧠
4
+ colorFrom: blue
5
+ colorTo: indigo
6
+ sdk: streamlit
7
+ sdk_version: 1.35.0
8
+ app_file: demo.py
9
+ pinned: false
10
+ ---
11
+
12
  # CodeSage — LLM vs RAG vs Fine-Tuning
13
 
14
  > A live comparative study of three NLP architectures for domain-specific Q&A, built with Streamlit.
demo.py CHANGED
@@ -499,7 +499,7 @@ def _estimate_cost(answer: str, system: str) -> float:
499
 
500
  def run_benchmark(progress_bar=None):
501
  results = []
502
- has_ft = os.path.exists("./finetuned_model")
503
  if has_ft:
504
  from system3_inference import ask_finetuned
505
  total = len(BENCHMARK_QUESTIONS)
@@ -734,8 +734,8 @@ if (run_clicked or st.session_state.auto_run) and question:
734
  with st.spinner("RAG retrieving + generating..."):
735
  r2 = ask_rag(question, vs)
736
  with col3:
737
- if os.path.exists("./finetuned_model"):
738
- with st.spinner("Fine-tuned model generating..."):
739
  from system3_inference import ask_finetuned
740
  r3 = ask_finetuned(question)
741
  else:
@@ -852,8 +852,7 @@ if st.session_state.last_results:
852
  </div>
853
  """, unsafe_allow_html=True)
854
  st.warning(
855
- "Run `system3_finetune_colab.ipynb` on Google Colab, "
856
- "download `finetuned_model.zip`, and unzip it here."
857
  )
858
  else:
859
  st.markdown(f"""
 
499
 
500
  def run_benchmark(progress_bar=None):
501
  results = []
502
+ has_ft = os.path.exists("./checkpoint-25") or os.path.exists("./finetuned_model")
503
  if has_ft:
504
  from system3_inference import ask_finetuned
505
  total = len(BENCHMARK_QUESTIONS)
 
734
  with st.spinner("RAG retrieving + generating..."):
735
  r2 = ask_rag(question, vs)
736
  with col3:
737
+ if os.path.exists("./checkpoint-25") or os.path.exists("./finetuned_model"):
738
+ with st.spinner("Fine-tuned model generating (first run downloads base model ~3GB)..."):
739
  from system3_inference import ask_finetuned
740
  r3 = ask_finetuned(question)
741
  else:
 
852
  </div>
853
  """, unsafe_allow_html=True)
854
  st.warning(
855
+ "Fine-tuned model adapter (checkpoint-25/) not found in the project root."
 
856
  )
857
  else:
858
  st.markdown(f"""