naman1102 commited on
Commit
4336f6d
·
1 Parent(s): f367387

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -11
app.py CHANGED
@@ -245,7 +245,9 @@ def create_ui() -> gr.Blocks:
245
  lines=5,
246
  placeholder="repo1, repo2\nrepo3"
247
  )
248
- submit_btn = gr.Button("Submit Repo IDs", variant="primary")
 
 
249
 
250
  with gr.Column():
251
  gr.Markdown("### Or Search by Keywords")
@@ -254,7 +256,9 @@ def create_ui() -> gr.Blocks:
254
  lines=3,
255
  placeholder="Enter keywords separated by commas"
256
  )
257
- search_btn = gr.Button("Search by Keywords", variant="primary")
 
 
258
 
259
  df_output = gr.Dataframe(
260
  headers=["repo id", "strength", "weaknesses", "speciality", "relevance rating"],
@@ -262,6 +266,7 @@ def create_ui() -> gr.Blocks:
262
  )
263
  with gr.Row():
264
  analyze_btn = gr.Button("Start Analysis", variant="primary")
 
265
  compare_btn = gr.Button("Compare Repositories", variant="secondary")
266
 
267
  # Analysis Page
@@ -281,8 +286,10 @@ def create_ui() -> gr.Blocks:
281
  summary_output = gr.Textbox(label="Analysis Summary", lines=10)
282
  with gr.Row():
283
  next_btn = gr.Button("Analyze Next Repository", variant="primary")
 
284
  finish_btn = gr.Button("Finish Analysis", variant="secondary")
285
  export_btn = gr.Button("Export Results", variant="secondary")
 
286
 
287
  # Comparison Page
288
  with gr.Group(visible=False) as comparison_page:
@@ -329,7 +336,9 @@ def create_ui() -> gr.Blocks:
329
  )
330
  with gr.Row():
331
  send_btn = gr.Button("Send", variant="primary")
 
332
  end_chat_btn = gr.Button("End Chat", variant="secondary")
 
333
 
334
  # Results Page
335
  with gr.Group(visible=False) as results_page:
@@ -385,15 +394,23 @@ def create_ui() -> gr.Blocks:
385
  )
386
 
387
  submit_btn.click(
 
 
 
 
388
  fn=process_repo_input,
389
  inputs=[repo_id_input, state],
390
- outputs=[df_output]
391
  )
392
 
393
  search_btn.click(
 
 
 
 
394
  fn=keyword_search_and_update,
395
  inputs=[keyword_input, state],
396
- outputs=[df_output]
397
  )
398
 
399
  analyze_btn.click(
@@ -403,9 +420,13 @@ def create_ui() -> gr.Blocks:
403
  )
404
 
405
  next_btn.click(
 
 
 
 
406
  fn=show_combined_repo_and_llm,
407
  inputs=[state],
408
- outputs=[content_output, summary_output, df_output]
409
  )
410
 
411
  finish_btn.click(
@@ -432,15 +453,23 @@ def create_ui() -> gr.Blocks:
432
  return keywords, navigate_to("results")
433
 
434
  send_btn.click(
435
- fn=user_send,
 
 
 
 
436
  inputs=[msg, chatbot, state],
437
- outputs=[chatbot, msg]
438
  )
439
 
440
  end_chat_btn.click(
441
- fn=end_chat,
 
 
 
 
442
  inputs=[chatbot, state],
443
- outputs=[gr.Textbox(label="Extracted Keywords"), [start_page, input_page, analysis_page, chatbot_page, results_page]]
444
  )
445
 
446
  restart_btn.click(
@@ -486,9 +515,13 @@ def create_ui() -> gr.Blocks:
486
 
487
  # Add new event handlers for new features
488
  export_btn.click(
489
- fn=export_results,
 
 
 
 
490
  inputs=[results_df],
491
- outputs=[gr.Textbox(label="Export Status")]
492
  )
493
 
494
  history_btn.click(
 
245
  lines=5,
246
  placeholder="repo1, repo2\nrepo3"
247
  )
248
+ with gr.Row():
249
+ submit_btn = gr.Button("Submit Repo IDs", variant="primary")
250
+ submit_loading = gr.Loading(visible=False)
251
 
252
  with gr.Column():
253
  gr.Markdown("### Or Search by Keywords")
 
256
  lines=3,
257
  placeholder="Enter keywords separated by commas"
258
  )
259
+ with gr.Row():
260
+ search_btn = gr.Button("Search by Keywords", variant="primary")
261
+ search_loading = gr.Loading(visible=False)
262
 
263
  df_output = gr.Dataframe(
264
  headers=["repo id", "strength", "weaknesses", "speciality", "relevance rating"],
 
266
  )
267
  with gr.Row():
268
  analyze_btn = gr.Button("Start Analysis", variant="primary")
269
+ analyze_loading = gr.Loading(visible=False)
270
  compare_btn = gr.Button("Compare Repositories", variant="secondary")
271
 
272
  # Analysis Page
 
286
  summary_output = gr.Textbox(label="Analysis Summary", lines=10)
287
  with gr.Row():
288
  next_btn = gr.Button("Analyze Next Repository", variant="primary")
289
+ next_loading = gr.Loading(visible=False)
290
  finish_btn = gr.Button("Finish Analysis", variant="secondary")
291
  export_btn = gr.Button("Export Results", variant="secondary")
292
+ export_loading = gr.Loading(visible=False)
293
 
294
  # Comparison Page
295
  with gr.Group(visible=False) as comparison_page:
 
336
  )
337
  with gr.Row():
338
  send_btn = gr.Button("Send", variant="primary")
339
+ send_loading = gr.Loading(visible=False)
340
  end_chat_btn = gr.Button("End Chat", variant="secondary")
341
+ end_chat_loading = gr.Loading(visible=False)
342
 
343
  # Results Page
344
  with gr.Group(visible=False) as results_page:
 
394
  )
395
 
396
  submit_btn.click(
397
+ fn=lambda: gr.update(visible=True),
398
+ inputs=[],
399
+ outputs=[submit_loading]
400
+ ).then(
401
  fn=process_repo_input,
402
  inputs=[repo_id_input, state],
403
+ outputs=[df_output, submit_loading]
404
  )
405
 
406
  search_btn.click(
407
+ fn=lambda: gr.update(visible=True),
408
+ inputs=[],
409
+ outputs=[search_loading]
410
+ ).then(
411
  fn=keyword_search_and_update,
412
  inputs=[keyword_input, state],
413
+ outputs=[df_output, search_loading]
414
  )
415
 
416
  analyze_btn.click(
 
420
  )
421
 
422
  next_btn.click(
423
+ fn=lambda: gr.update(visible=True),
424
+ inputs=[],
425
+ outputs=[next_loading]
426
+ ).then(
427
  fn=show_combined_repo_and_llm,
428
  inputs=[state],
429
+ outputs=[content_output, summary_output, df_output, next_loading]
430
  )
431
 
432
  finish_btn.click(
 
453
  return keywords, navigate_to("results")
454
 
455
  send_btn.click(
456
+ fn=lambda: gr.update(visible=True),
457
+ inputs=[],
458
+ outputs=[send_loading]
459
+ ).then(
460
+ fn=send_message_with_loading,
461
  inputs=[msg, chatbot, state],
462
+ outputs=[chatbot, msg, send_loading]
463
  )
464
 
465
  end_chat_btn.click(
466
+ fn=lambda: gr.update(visible=True),
467
+ inputs=[],
468
+ outputs=[end_chat_loading]
469
+ ).then(
470
+ fn=end_chat_with_loading,
471
  inputs=[chatbot, state],
472
+ outputs=[gr.Textbox(label="Extracted Keywords"), [start_page, input_page, analysis_page, chatbot_page, results_page, help_page, comparison_page, history_page], end_chat_loading]
473
  )
474
 
475
  restart_btn.click(
 
515
 
516
  # Add new event handlers for new features
517
  export_btn.click(
518
+ fn=lambda: gr.update(visible=True),
519
+ inputs=[],
520
+ outputs=[export_loading]
521
+ ).then(
522
+ fn=export_with_loading,
523
  inputs=[results_df],
524
+ outputs=[gr.Textbox(label="Export Status"), export_loading]
525
  )
526
 
527
  history_btn.click(