Spaces:
Sleeping
Sleeping
error handle commitw
Browse files- app.py +14 -6
- proper_main.py +11 -2
app.py
CHANGED
@@ -9,6 +9,8 @@ def main():
|
|
9 |
|
10 |
# User input
|
11 |
user_url = st.text_input("Enter the Github URL")
|
|
|
|
|
12 |
|
13 |
# Generate response
|
14 |
if st.button("Submit"):
|
@@ -22,15 +24,21 @@ def main():
|
|
22 |
if status == 0:
|
23 |
repo_path = data_cloning(repos,st)
|
24 |
data_cleaning(repo_path,st)
|
25 |
-
query = analyse(st)
|
26 |
if len(query) == 0:
|
27 |
st.write("The given User's URL doesnt Contain Python Repository")
|
28 |
st.experimental_rerun()
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
else:
|
35 |
output = st.empty()
|
36 |
output.error("Error occurred. Please contact the admin {e}.")
|
|
|
9 |
|
10 |
# User input
|
11 |
user_url = st.text_input("Enter the Github URL")
|
12 |
+
|
13 |
+
option = st.radio("What you want me to do",["Self Analysis","GPT Evaluation"])
|
14 |
|
15 |
# Generate response
|
16 |
if st.button("Submit"):
|
|
|
24 |
if status == 0:
|
25 |
repo_path = data_cloning(repos,st)
|
26 |
data_cleaning(repo_path,st)
|
27 |
+
query,report_analysis = analyse(st)
|
28 |
if len(query) == 0:
|
29 |
st.write("The given User's URL doesnt Contain Python Repository")
|
30 |
st.experimental_rerun()
|
31 |
+
if option == "Self Analysis":
|
32 |
+
repo_name,score=self_analysis(report_analysis)
|
33 |
+
st.write("The Complex Repo is",repo_name," Because the Complexity Score is",score)
|
34 |
+
st.experimental_rerun()
|
35 |
+
|
36 |
+
elif option == "GPT Evaluation":
|
37 |
+
response_gpt = llm_chain([str(query)])
|
38 |
+
# Display the response
|
39 |
+
st.text_area("Bot Response:", value=response_gpt['text'], height=100)
|
40 |
+
elapsed_time = time.time() - strttime
|
41 |
+
st.text(f"Execution time: {elapsed_time:.2f} seconds")
|
42 |
else:
|
43 |
output = st.empty()
|
44 |
output.error("Error occurred. Please contact the admin {e}.")
|
proper_main.py
CHANGED
@@ -97,6 +97,7 @@ def data_cleaning(directory,st):
|
|
97 |
|
98 |
def analyse(st):
|
99 |
project_and_grades = {}
|
|
|
100 |
st.text("Analysing...")
|
101 |
if len(os.listdir(os.getcwd())) ==0:
|
102 |
st.text("Not a Valid Repo")
|
@@ -111,7 +112,7 @@ def analyse(st):
|
|
111 |
index = res.decode().find("Average")
|
112 |
if index <= 0:
|
113 |
grade = "A"
|
114 |
-
score =
|
115 |
else:
|
116 |
grade = res.decode()[index:]
|
117 |
score = grade[23:-1]
|
@@ -120,9 +121,17 @@ def analyse(st):
|
|
120 |
|
121 |
|
122 |
project_and_grades["Repo " + file] = "Grade " + grade + " Score " + str(score)
|
|
|
123 |
shutil.rmtree('/tmp/repos')
|
124 |
|
125 |
-
return project_and_grades
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
|
127 |
|
128 |
|
|
|
97 |
|
98 |
def analyse(st):
|
99 |
project_and_grades = {}
|
100 |
+
report_analysis = {}
|
101 |
st.text("Analysing...")
|
102 |
if len(os.listdir(os.getcwd())) ==0:
|
103 |
st.text("Not a Valid Repo")
|
|
|
112 |
index = res.decode().find("Average")
|
113 |
if index <= 0:
|
114 |
grade = "A"
|
115 |
+
score = 0.5
|
116 |
else:
|
117 |
grade = res.decode()[index:]
|
118 |
score = grade[23:-1]
|
|
|
121 |
|
122 |
|
123 |
project_and_grades["Repo " + file] = "Grade " + grade + " Score " + str(score)
|
124 |
+
report_analysis["Repo " + file] = [float(score)]
|
125 |
shutil.rmtree('/tmp/repos')
|
126 |
|
127 |
+
return project_and_grades,report_analysis
|
128 |
+
|
129 |
+
|
130 |
+
|
131 |
+
def self_analysis(report_analysis):
|
132 |
+
score= max(report_analysis.values())
|
133 |
+
repo = max(resport_analysis,key=report_analysis.get())
|
134 |
+
return repo,score
|
135 |
|
136 |
|
137 |
|