Aiswarya Sankar commited on
Commit
f1fc3bd
·
1 Parent(s): 42edd05

Update repo state variable

Browse files
Files changed (1) hide show
  1. app.py +15 -10
app.py CHANGED
@@ -76,14 +76,15 @@ class GithubResponse(BaseModel):
76
 
77
 
78
  # global repoName
79
- global ticket_titles
80
- global tickets
81
- global ticket_choices
82
  tickets = []
83
 
84
 
85
  repo_name = gr.State()
86
- repoName = "https://github.com/gradio-app/gradio.git"
 
87
 
88
  embeddings = OpenAIEmbeddings(disallowed_special=())
89
 
@@ -189,11 +190,13 @@ def index_repo(textbox: str, dropdown: str) -> Response:
189
  stdout="",
190
  )
191
 
192
- global ticket_choices, ticket_titles, tickets
193
  repo = "/".join(repo[:-4].split("/")[-2:])
194
  tickets = fetchGithubIssues(repo, 10)
 
 
195
  print("TICKET CREATION: " + str(repo))
196
- print(tickets)
197
 
198
  return {
199
  success_response: "SUCCESS",
@@ -365,7 +368,8 @@ def solveGithubIssue(ticket, history) -> Response:
365
  """
366
  # global repoName
367
  repoName = repo_name.value
368
- global ticket_choices
 
369
  github = repoName[:-4]
370
 
371
  repoFolder = github.split("/")[-1]
@@ -429,6 +433,7 @@ def bot(history, **kwargs):
429
 
430
  # global repoName
431
  repoName = repo_name.value
 
432
  github = repoName[:-4]
433
  try:
434
  embeddings = OpenAIEmbeddings()
@@ -482,9 +487,9 @@ with gr.Blocks() as demo:
482
 
483
  success_response = gr.Textbox(label="")
484
  ingest_btn = gr.Button("Index repo")
485
- ticketDropdown = gr.Dropdown()
486
 
487
- repoTextBox.submit(fetchGithubIssues, [], ticketDropdown)
488
 
489
  with gr.Column(visible=False) as launch_product:
490
 
@@ -511,7 +516,7 @@ with gr.Blocks() as demo:
511
  ), gr.update(visible=True)
512
 
513
  # global ticket_choices, ticket_titles, tickets
514
- repo = "/".join(repoName[:-4].split("/")[-2:])
515
  tickets = fetchGithubIssues(repo, 10)
516
 
517
  # Create the dropdown
 
76
 
77
 
78
  # global repoName
79
+ # global ticket_titles
80
+ # global tickets
81
+ # global ticket_choices
82
  tickets = []
83
 
84
 
85
  repo_name = gr.State()
86
+ git_tickets = gr.State()
87
+ # repoName = "https://github.com/gradio-app/gradio.git"
88
 
89
  embeddings = OpenAIEmbeddings(disallowed_special=())
90
 
 
190
  stdout="",
191
  )
192
 
193
+ # global ticket_choices, ticket_titles, tickets
194
  repo = "/".join(repo[:-4].split("/")[-2:])
195
  tickets = fetchGithubIssues(repo, 10)
196
+ git_tickets.value = tickets
197
+
198
  print("TICKET CREATION: " + str(repo))
199
+ print(git_tickets.value)
200
 
201
  return {
202
  success_response: "SUCCESS",
 
368
  """
369
  # global repoName
370
  repoName = repo_name.value
371
+ ticket_choices = git_tickets.value
372
+ # global ticket_choices
373
  github = repoName[:-4]
374
 
375
  repoFolder = github.split("/")[-1]
 
433
 
434
  # global repoName
435
  repoName = repo_name.value
436
+ print("STATE REPO NAME: " + repoName)
437
  github = repoName[:-4]
438
  try:
439
  embeddings = OpenAIEmbeddings()
 
487
 
488
  success_response = gr.Textbox(label="")
489
  ingest_btn = gr.Button("Index repo")
490
+ # ticketDropdown = gr.Dropdown()
491
 
492
+ # repoTextBox.submit(fetchGithubIssues, [], ticketDropdown)
493
 
494
  with gr.Column(visible=False) as launch_product:
495
 
 
516
  ), gr.update(visible=True)
517
 
518
  # global ticket_choices, ticket_titles, tickets
519
+ repo = "/".join(repo_name.value[:-4].split("/")[-2:])
520
  tickets = fetchGithubIssues(repo, 10)
521
 
522
  # Create the dropdown