SandeepU commited on
Commit
4de86cb
·
verified ·
1 Parent(s): 841ffa5

Upload 2 files

Browse files
Files changed (1) hide show
  1. streamlit_app.py +3 -3
streamlit_app.py CHANGED
@@ -3,7 +3,7 @@ from model.model_utils import load_model, generate_explanation
3
 
4
  st.set_page_config(page_title="Code Explainer", layout="centered")
5
 
6
- st.title("🧠 Code Explainer (CodeBERT)")
7
  st.write("Paste your Python code below and get a natural language explanation:")
8
 
9
  code_input = st.text_area("Paste Python Code", height=200)
@@ -11,8 +11,8 @@ code_input = st.text_area("Paste Python Code", height=200)
11
  if st.button("Explain"):
12
  if code_input.strip():
13
  with st.spinner("Generating explanation..."):
14
- tokenizer, model, device = load_model()
15
- explanation = generate_explanation(code_input, tokenizer, model, device)
16
  st.subheader("✅ Explanation")
17
  st.write(explanation)
18
  else:
 
3
 
4
  st.set_page_config(page_title="Code Explainer", layout="centered")
5
 
6
+ st.title("🧠 Code Explainer (CodeT5-small)")
7
  st.write("Paste your Python code below and get a natural language explanation:")
8
 
9
  code_input = st.text_area("Paste Python Code", height=200)
 
11
  if st.button("Explain"):
12
  if code_input.strip():
13
  with st.spinner("Generating explanation..."):
14
+ tokenizer, model = load_model()
15
+ explanation = generate_explanation(code_input, tokenizer, model)
16
  st.subheader("✅ Explanation")
17
  st.write(explanation)
18
  else: