Aiswarya Sankar commited on
Commit
a0382e7
·
1 Parent(s): e6048bc

Clean code

Browse files
Files changed (1) hide show
  1. app.py +33 -37
app.py CHANGED
@@ -276,7 +276,6 @@ def fetchGithubIssues(**kwargs) -> Response:
276
  query = f"issues?page={page}&per_page={per_page}&state=all"
277
  issues = requests.get(f"{base_url}/{repo}/{query}", headers=headers)
278
  print(f"{base_url}/{repo}/{query}")
279
- print("Issues: " + str(issues))
280
 
281
  batch.extend(issues.json())
282
  for issue in issues.json():
@@ -291,9 +290,6 @@ def fetchGithubIssues(**kwargs) -> Response:
291
  git_tickets.value = issues_data
292
  git_ticket_choices.value = {ticket["title"]: ticket for ticket in issues_data}
293
  git_titles.value = [ticket["title"] for ticket in issues_data]
294
- print("git_tickets: " + str(git_tickets.value))
295
- print("git_choices: " + str(git_ticket_choices.value))
296
- print("git_titles: " + str(git_titles.value))
297
  return issues_data
298
 
299
 
@@ -530,45 +526,45 @@ with gr.Blocks() as demo:
530
  clear.click(lambda: None, None, chatbot, queue=False)
531
 
532
 
533
- # with gr.Tab("AI Code Documentation"):
534
 
535
- # # global repoName
536
- # # First parse through the folder structure and store that as a list of clickable buttons
537
- # gr.Markdown("""
538
- # ## AI Generated Code Documentation
539
- # Code documentation comes in 3 flavors - internal engineering, external API documentation and product documentation. Each offers different layers of abstraction over the code base.
540
- # """)
541
-
542
- # # docs = generateDocumentationPerFolder("overview", repo_name)
543
-
544
- # # For now let's just display all of the docs in one big file
545
- # allDocs = ""
546
- # dirNames = generateFolderNamesForRepo(repoName[:-4])
547
- # for dir in dirNames:
548
- # if dir[0] != ".":
549
- # allDocs += generateDocumentationPerFolder(dir, repoName[:-4]) + '\n\n'
550
 
551
- # gr.Markdown(allDocs)
552
 
553
- # def button_click_callback(markdown):
554
- # docs = generateDocumentationPerFolder("overview", repoName[:-4])
555
- # markdown.update(docs)
 
 
 
556
 
557
- # markdown = gr.Markdown()
558
- # # Generate the left column buttons and their names and wrap each one in a function
559
- # with gr.Row():
560
- # with gr.Column(scale=.5, min_width=300):
561
- # dirNames = generateFolderNamesForRepo(repoName[:-4])
562
- # buttons = [gr.Button(folder_name) for folder_name in dirNames]
563
- # for btn, folder_name in zip(buttons, dirNames):
564
- # btn.click(button_click_callback, [markdown], [markdown] )
565
 
 
 
 
566
 
567
- # # Generate the overall documentation for the main bubble at the same time
568
- # with gr.Column(scale=2, min_width=300):
569
- # docs = generateDocumentationPerFolder("overview", repoName[:-4])
570
- # markdown.update(docs)
571
- # # markdown.render()
 
 
 
 
 
 
 
 
 
 
572
 
573
 
574
  with gr.Tab("Custom Model Finetuning"):
 
276
  query = f"issues?page={page}&per_page={per_page}&state=all"
277
  issues = requests.get(f"{base_url}/{repo}/{query}", headers=headers)
278
  print(f"{base_url}/{repo}/{query}")
 
279
 
280
  batch.extend(issues.json())
281
  for issue in issues.json():
 
290
  git_tickets.value = issues_data
291
  git_ticket_choices.value = {ticket["title"]: ticket for ticket in issues_data}
292
  git_titles.value = [ticket["title"] for ticket in issues_data]
 
 
 
293
  return issues_data
294
 
295
 
 
526
  clear.click(lambda: None, None, chatbot, queue=False)
527
 
528
 
529
+ with gr.Tab("AI Code Documentation"):
530
 
531
+ repoName = repo_name.value
532
+ # First parse through the folder structure and store that as a list of clickable buttons
533
+ gr.Markdown("""
534
+ ## AI Generated Code Documentation
535
+ Code documentation comes in 3 flavors - internal engineering, external API documentation and product documentation. Each offers different layers of abstraction over the code base.
536
+ """)
 
 
 
 
 
 
 
 
 
537
 
538
+ # docs = generateDocumentationPerFolder("overview", repo_name)
539
 
540
+ # For now let's just display all of the docs in one big file
541
+ allDocs = ""
542
+ dirNames = generateFolderNamesForRepo(repoName[:-4])
543
+ for dir in dirNames:
544
+ if dir[0] != ".":
545
+ allDocs += generateDocumentationPerFolder(dir, repoName[:-4]) + '\n\n'
546
 
547
+ gr.Markdown(allDocs)
 
 
 
 
 
 
 
548
 
549
+ def button_click_callback(markdown):
550
+ docs = generateDocumentationPerFolder("overview", repoName[:-4])
551
+ markdown.update(docs)
552
 
553
+ markdown = gr.Markdown()
554
+ # Generate the left column buttons and their names and wrap each one in a function
555
+ with gr.Row():
556
+ with gr.Column(scale=.5, min_width=300):
557
+ dirNames = generateFolderNamesForRepo(repoName[:-4])
558
+ buttons = [gr.Button(folder_name) for folder_name in dirNames]
559
+ for btn, folder_name in zip(buttons, dirNames):
560
+ btn.click(button_click_callback, [markdown], [markdown] )
561
+
562
+
563
+ # Generate the overall documentation for the main bubble at the same time
564
+ with gr.Column(scale=2, min_width=300):
565
+ docs = generateDocumentationPerFolder("overview", repoName[:-4])
566
+ markdown.update(docs)
567
+ # markdown.render()
568
 
569
 
570
  with gr.Tab("Custom Model Finetuning"):