|
import streamlit as st |
|
import time |
|
from handler import * |
|
|
|
def main(): |
|
""" Creates a Streamlit page for code analysis """ |
|
prompt=None |
|
code=None |
|
|
|
st.set_page_config(page_title="CodeBatuk: Code Review Tool", page_icon="") |
|
st.title("Code Batuk") |
|
st.subheader("A code Analysis Tool") |
|
|
|
col1, col2 = st.columns([3,1]) |
|
with col1: |
|
|
|
code = st.text_area(label="Enter your code here:", height=200) |
|
|
|
with col2: |
|
|
|
analysis_type = st.radio("Choose analysis type:", |
|
("Code review", "Code refinement","Documentation", "Resume Writer")) |
|
|
|
|
|
if st.button("Submit"): |
|
|
|
if analysis_type == "Code review": |
|
res=review_code(code, prompt) |
|
|
|
st.markdown(res['text']) |
|
time.sleep(1) |
|
|
|
|
|
elif analysis_type == "Code refinement": |
|
res=refine_code(code, prompt) |
|
|
|
st.markdown(res['text']) |
|
|
|
elif analysis_type == "Documentation": |
|
res=generate_documentation(code, prompt) |
|
|
|
st.markdown(res['text']) |
|
elif analysis_type == "Resume Writer": |
|
res=resume_writer(code, prompt) |
|
|
|
st.markdown(res['text']) |
|
|
|
st.success(f"Code analysis for {analysis_type} submitted successfully!") |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|