File size: 1,856 Bytes
dbfcd07
 
 
fb25cb2
dbfcd07
 
 
fb25cb2
dbfcd07
fb25cb2
 
 
 
dbfcd07
fb25cb2
 
dbfcd07
fb25cb2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
dbfcd07
 
 
 
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
import streamlit as st
from resource import *
from proper_main import *
from resource import llm_chain
import time

def main():
    st.title("Github Automated Repo Analysis")

    # User input
    user_url = st.text_input("Enter the Github URL")
    
    option = st.radio("What you want me to do",["Python Analysis","GPT Evaluation"])

    # Generate response
    if st.button("Submit"):

        st.text("Please wait Automation is Processing")
        strttime=time.time()
        repos, status = web_scrape(user_url,st)
        
        #task_progress = st.progress(0)
        #task_progress.progress("Tools is taking action please wait")
        if status == 0:
            repo_path = data_cloning(repos,st)
            data_cleaning(repo_path,st)
            query,report_analysis = analyse(st)
            if len(query) == 0:
            	st.write("The given User's URL doesnt Contain Python Repository")
            if option == "Python Analysis":
            	repo_name,score=self_analysis(report_analysis)
            	output="The Complex Repo is "+ str(repo_name)+" Because the Complexity Score is "+str(score)
            	#st.write("The Complex Repo is",repo_name," Because the Complexity Score is",score)
            	st.text_area("Bot Response:", value=output, height=100)
            	time.sleep(15)
            	
            elif option == "GPT Evaluation":
            	response_gpt = llm_chain([str(query)])
            	# Display the response
            	st.text_area("Bot Response:", value=response_gpt['text'], height=100)
            	elapsed_time = time.time() - strttime
            	st.text(f"Execution time: {elapsed_time:.2f} seconds")
        else:
            output = st.empty()
            output.error(f"Error occurred. Please contact the admin {repos}.")
            time.sleep(5)

if __name__ == "__main__":
    main()