thedamn commited on
Commit
3c5daa9
·
1 Parent(s): 374a0fa

error commitw

Browse files
Files changed (2) hide show
  1. app.py +4 -1
  2. proper_main.py +11 -24
app.py CHANGED
@@ -30,7 +30,10 @@ def main():
30
  st.experimental_rerun()
31
  if option == "Python 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":
 
30
  st.experimental_rerun()
31
  if option == "Python Analysis":
32
  repo_name,score=self_analysis(report_analysis)
33
+ output="The Complex Repo is "+ str(repo_name)+" Because the Complexity Score is "+str(score)
34
+ #st.write("The Complex Repo is",repo_name," Because the Complexity Score is",score)
35
+ st.text_area("Bot Response:", value=output, height=100)
36
+ time.sleep(15)
37
  st.experimental_rerun()
38
 
39
  elif option == "GPT Evaluation":
proper_main.py CHANGED
@@ -23,32 +23,19 @@ except Exception as e:
23
 
24
 
25
 
26
- def web_scrape(user_url,st):
27
- base_url = "https://www.github.com"
28
- st.text("Extracting the Repos")
29
- repos = []
30
- user_url = user_url
31
-
32
- if user_url.endswith("/"):
33
- user_url = user_url[:-1]
34
-
35
- try:
36
- response = requests.get(user_url + "?tab=repositories")
37
- except Exception as e:
38
- return ("Please provide a valid link:", 1)
39
-
40
  if response.status_code != 200:
41
  return ("Please provide a valid link.",1)
42
-
43
- make_soup = BeautifulSoup(response.text, 'html.parser')
44
- li = make_soup.findAll('div', class_='d-inline-block mb-1')
45
- if len(li) == 0:
46
- return ("Please Provide the Valid Link",1)
47
-
48
- for _, i in enumerate(li):
49
- for a in i.findAll('a'):
50
- new_url = base_url + a['href']
51
- repos.append(new_url)
52
  return (repos,0)
53
 
54
 
 
23
 
24
 
25
 
26
+ def web_scrape(username,st):
27
+ base_url = f"https://api.github.com/users/{username}/repos"
28
+ response = requests.get(url)
 
 
 
 
 
 
 
 
 
 
 
29
  if response.status_code != 200:
30
  return ("Please provide a valid link.",1)
31
+ st.text("Extracting the Repos")
32
+ repos = []
33
+ repositories = response.json()
34
+ for repo in repositories:
35
+
36
+ repo_name = repo["name"]
37
+
38
+ repos.append(repo_name)
 
 
39
  return (repos,0)
40
 
41