Spaces:
Sleeping
Sleeping
Upload 3 files
Browse files- README.md +4 -4
- streamlit_app.py +3 -3
README.md
CHANGED
@@ -9,11 +9,11 @@ app_file: streamlit_app.py
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
-
# 🧠 Code Explainer (CodeT5-base
|
13 |
|
14 |
-
This app uses `Salesforce/codet5-base-multi-sum
|
15 |
|
16 |
## How to Use
|
17 |
-
1. Paste Python code
|
18 |
2. Click "Explain".
|
19 |
-
3.
|
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
+
# 🧠 Code Explainer (Final - CodeT5-base)
|
13 |
|
14 |
+
This app uses `Salesforce/codet5-base-multi-sum` with optimized prompts for generating docstring-like explanations of Python code.
|
15 |
|
16 |
## How to Use
|
17 |
+
1. Paste your Python code.
|
18 |
2. Click "Explain".
|
19 |
+
3. Get a plain English explanation generated by an AI model.
|
streamlit_app.py
CHANGED
@@ -3,8 +3,8 @@ 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 (CodeT5-base
|
7 |
-
st.write("Paste your Python code below and get a
|
8 |
|
9 |
code_input = st.text_area("Paste Python Code", height=200)
|
10 |
|
@@ -12,7 +12,7 @@ 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:
|
|
|
3 |
|
4 |
st.set_page_config(page_title="Code Explainer", layout="centered")
|
5 |
|
6 |
+
st.title("🧠 Code Explainer (Final - CodeT5-base)")
|
7 |
+
st.write("Paste your Python code below and get a high-quality explanation:")
|
8 |
|
9 |
code_input = st.text_area("Paste Python Code", height=200)
|
10 |
|
|
|
12 |
if code_input.strip():
|
13 |
with st.spinner("Generating explanation..."):
|
14 |
tokenizer, model = load_model()
|
15 |
+
explanation = generate_explanation(code_input.strip(), tokenizer, model)
|
16 |
st.subheader("✅ Explanation")
|
17 |
st.write(explanation)
|
18 |
else:
|