Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- README.md +4 -4
- prompt_utils.py +1 -5
- 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
|
| 15 |
|
| 16 |
-
##
|
| 17 |
1. Paste Python code in the box
|
| 18 |
2. Click "Explain"
|
| 19 |
-
3.
|
|
|
|
| 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"
|
| 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
|
| 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.")
|