Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -66,22 +66,22 @@ def get_inline_diff(original, modified):
|
|
66 |
return '\n'.join(diff)
|
67 |
|
68 |
# --- STREAMLIT APP ---
|
69 |
-
st.set_page_config(page_title="
|
70 |
st.title("CodeGenie")
|
71 |
|
72 |
# Navigation
|
73 |
-
page = st.sidebar.radio("Navigate", ["Home", "
|
74 |
|
75 |
if page == "Home":
|
76 |
st.header("Welcome to the Code Genie!")
|
77 |
st.markdown("""
|
78 |
-
- **Full
|
79 |
- **Semantic Search:** Ask natural language questions about your code and get intelligent answers
|
80 |
""")
|
81 |
st.info("Select a feature from the sidebar to get started.")
|
82 |
|
83 |
-
elif page == "
|
84 |
-
st.header("Full
|
85 |
code_input = st.text_area("Paste your code here", height=200)
|
86 |
uploaded_file = st.file_uploader("Or upload a code file", type=["py", "js", "ts", "java", "cpp", "cs"])
|
87 |
if uploaded_file:
|
@@ -104,7 +104,7 @@ elif page == "AI Workflow":
|
|
104 |
elif not code_matches_language(code_input, programming_language):
|
105 |
st.error(f"Language mismatch. Please check your code and language selection.")
|
106 |
else:
|
107 |
-
with st.spinner("Running
|
108 |
steps = [
|
109 |
("Explain", call_groq_api(f"Explain this {programming_language} code for a {skill_level} {user_role} in {explanation_language}:\n{code_input}")),
|
110 |
("Refactor", call_blackbox_agent(f"Refactor this {programming_language} code: {code_input}")),
|
@@ -124,7 +124,7 @@ elif page == "AI Workflow":
|
|
124 |
refactored_code = steps[1][1] # Blackbox agent output
|
125 |
st.code(get_inline_diff(code_input, refactored_code), language=programming_language.lower())
|
126 |
# Download report
|
127 |
-
report = f"
|
128 |
for t in timeline:
|
129 |
report += f"## {t['step']}\n{t['output']}\n\n---\n\n"
|
130 |
st.download_button("Download Report", report, file_name="ai_workflow_report.txt")
|
|
|
66 |
return '\n'.join(diff)
|
67 |
|
68 |
# --- STREAMLIT APP ---
|
69 |
+
st.set_page_config(page_title="Code Workflows", layout="wide")
|
70 |
st.title("CodeGenie")
|
71 |
|
72 |
# Navigation
|
73 |
+
page = st.sidebar.radio("Navigate", ["Home", "Code Workflow", "Semantic Search"])
|
74 |
|
75 |
if page == "Home":
|
76 |
st.header("Welcome to the Code Genie!")
|
77 |
st.markdown("""
|
78 |
+
- **Full Code Workflow:** Complete code analysis pipeline with explanation, refactoring, review, and testing (powered by Groq/Blackbox)
|
79 |
- **Semantic Search:** Ask natural language questions about your code and get intelligent answers
|
80 |
""")
|
81 |
st.info("Select a feature from the sidebar to get started.")
|
82 |
|
83 |
+
elif page == "Code Workflow":
|
84 |
+
st.header("Full Code Workflow")
|
85 |
code_input = st.text_area("Paste your code here", height=200)
|
86 |
uploaded_file = st.file_uploader("Or upload a code file", type=["py", "js", "ts", "java", "cpp", "cs"])
|
87 |
if uploaded_file:
|
|
|
104 |
elif not code_matches_language(code_input, programming_language):
|
105 |
st.error(f"Language mismatch. Please check your code and language selection.")
|
106 |
else:
|
107 |
+
with st.spinner("Running Code Workflow..."):
|
108 |
steps = [
|
109 |
("Explain", call_groq_api(f"Explain this {programming_language} code for a {skill_level} {user_role} in {explanation_language}:\n{code_input}")),
|
110 |
("Refactor", call_blackbox_agent(f"Refactor this {programming_language} code: {code_input}")),
|
|
|
124 |
refactored_code = steps[1][1] # Blackbox agent output
|
125 |
st.code(get_inline_diff(code_input, refactored_code), language=programming_language.lower())
|
126 |
# Download report
|
127 |
+
report = f"Code Workflow Report\nGenerated on: {datetime.datetime.now()}\nLanguage: {programming_language}\nSkill Level: {skill_level}\nRole: {user_role}\n\n"
|
128 |
for t in timeline:
|
129 |
report += f"## {t['step']}\n{t['output']}\n\n---\n\n"
|
130 |
st.download_button("Download Report", report, file_name="ai_workflow_report.txt")
|