SandeepU commited on
Commit
f0ebfa0
·
verified ·
1 Parent(s): 092f4f2

Upload 4 files

Browse files
Files changed (3) hide show
  1. README.md +4 -4
  2. prompt_utils.py +1 -5
  3. streamlit_app.py +1 -1
README.md CHANGED
@@ -9,11 +9,11 @@ app_file: streamlit_app.py
9
  pinned: false
10
  ---
11
 
12
- # 🧠 Code Explainer (Codet5 Version)
13
 
14
- This app uses `Salesforce/codet5-base` to explain Python code snippets in plain English. Optimized for CPU-only Hugging Face Spaces.
15
 
16
- ## 🛠 How to Use
17
  1. Paste Python code in the box
18
  2. Click "Explain"
19
- 3. Read the AI-generated step-by-step explanation
 
9
  pinned: false
10
  ---
11
 
12
+ # 🧠 Code Explainer (Codet5 Version – Prompt Fixed)
13
 
14
+ This app uses `Salesforce/codet5-base` to explain Python code snippets in plain English using task prompts.
15
 
16
+ ## How to Use
17
  1. Paste Python code in the box
18
  2. Click "Explain"
19
+ 3. Get step-by-step plain English explanation
prompt_utils.py CHANGED
@@ -1,6 +1,2 @@
1
  def build_prompt(code_snippet):
2
- return f"""### Explain this Python code step-by-step:
3
- ```python
4
- {code_snippet}
5
- ```
6
- Explanation:"""
 
1
  def build_prompt(code_snippet):
2
+ return f"translate Python to English: {code_snippet}"
 
 
 
 
streamlit_app.py CHANGED
@@ -22,6 +22,6 @@ if st.button("Explain"):
22
  st.code(explanation)
23
 
24
  st.subheader("✅ Final Explanation")
25
- st.write(explanation.split("Explanation:")[-1].strip())
26
  else:
27
  st.warning("Please paste some code to explain.")
 
22
  st.code(explanation)
23
 
24
  st.subheader("✅ Final Explanation")
25
+ st.write(explanation)
26
  else:
27
  st.warning("Please paste some code to explain.")