Spaces:
Running
Running
File size: 2,422 Bytes
c9c95fa 2598145 c9c95fa 849993d 2598145 849993d c9c95fa | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | # app.py β Streamlit UI for AutoReview AI
import streamlit as st
from main import review_pr_simple
# ββ PAGE CONFIG βββββββββββββββββββββββββββ
st.set_page_config(
page_title="AutoReview AI",
page_icon="π€",
layout="centered"
)
# ββ TITLE βββββββββββββββββββββββββββββββββ
st.title("π€ AutoReview AI")
st.markdown("*Autonomous GitHub PR Reviewer powered by LLaMA + Groq*")
st.divider()
# ββ INPUT βββββββββββββββββββββββββββββββββ
pr_url = st.text_input(
"Enter GitHub PR URL",
placeholder="https://github.com/owner/repo/pull/123"
)
github_token = st.text_input(
"GitHub Personal Access Token (Optional)",
type="password",
placeholder="ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
help="Required only for private repositories. Leave blank for public repositories."
)
# ββ BUTTON ββββββββββββββββββββββββββββββββ
if st.button("π Review PR", type="primary"):
# check if URL is empty
if not pr_url:
st.warning("Please enter a PR URL first!")
else:
# show spinner while reviewing
with st.spinner("π€ Reviewing PR... this may take 30 seconds"):
try:
result = review_pr_simple(
pr_url=pr_url,
github_token=github_token or None
)
except Exception as e:
result = {"success": False, "error": f"Unexpected error: {str(e)}"}
# if success
if result["success"]:
st.success("β
Review Complete!")
st.divider()
# show PR data
st.subheader("π PR Summary")
st.code(result["pr_data"][:500])
# show analysis
st.subheader("π Code Analysis")
st.write(result["analysis"])
# show verdict
st.subheader("β
Final Verdict")
st.write(result["verdict"])
# if failed
else:
st.error(f"β Failed: {result['error']}")
# ββ FOOTER ββββββββββββββββββββββββββββββββ
st.divider()
st.caption("Built with LangChain + Groq + Streamlit") |