eljanmahammadli commited on
Commit
d09cdf3
·
1 Parent(s): 7c7ccca

adding mail as format type and plain text to structure

Browse files
Files changed (1) hide show
  1. app.py +24 -0
app.py CHANGED
@@ -422,6 +422,25 @@ def update_visibility_api(model: str):
422
  return gr.update(visible=False)
423
 
424
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
425
  def generate_and_format(
426
  input_role,
427
  topic,
@@ -556,6 +575,7 @@ def create_interface():
556
  "Research paper",
557
  "News article",
558
  "White paper",
 
559
  "LinkedIn post",
560
  "X (Twitter) post",
561
  "Instagram Video Content",
@@ -628,10 +648,12 @@ def create_interface():
628
  "Abstract, Introduction, Methods, Results, Discussion, Conclusion",
629
  "Executive Summary, Problem Statement, Analysis, Recommendations, Conclusion",
630
  "Introduction, Literature Review, Methodology, Findings, Analysis, Conclusion",
 
631
  ],
632
  value="Introduction, Body, Conclusion",
633
  label="Structure",
634
  elem_classes="input-highlight-turquoise",
 
635
  )
636
  input_references = gr.Dropdown(
637
  choices=[
@@ -805,6 +827,8 @@ def create_interface():
805
  ai_comments.change(regenerate_visible, inputs=output_article, outputs=regenerate_btn)
806
  ai_check_btn.click(highlight_visible, inputs=ai_detector_dropdown, outputs=highlighted_text)
807
 
 
 
808
  generate_btn.click(
809
  fn=generate_and_format,
810
  inputs=[
 
422
  return gr.update(visible=False)
423
 
424
 
425
+ # Function to update the default selected structure based on the selected format
426
+ def update_structure(format_choice):
427
+ # List of formats that should use "Plain Text"
428
+ plain_text_formats = [
429
+ "TikTok Video Content",
430
+ "Instagram Video Content",
431
+ "LinkedIn post",
432
+ "X (Twitter) post",
433
+ "Facebook post",
434
+ "Email",
435
+ ]
436
+
437
+ # Set the appropriate default structure based on the selected format
438
+ if format_choice in plain_text_formats:
439
+ return gr.update(value="Plain Text", interactive=True)
440
+ else:
441
+ return gr.update(value="Introduction, Body, Conclusion", interactive=True)
442
+
443
+
444
  def generate_and_format(
445
  input_role,
446
  topic,
 
575
  "Research paper",
576
  "News article",
577
  "White paper",
578
+ "Email",
579
  "LinkedIn post",
580
  "X (Twitter) post",
581
  "Instagram Video Content",
 
648
  "Abstract, Introduction, Methods, Results, Discussion, Conclusion",
649
  "Executive Summary, Problem Statement, Analysis, Recommendations, Conclusion",
650
  "Introduction, Literature Review, Methodology, Findings, Analysis, Conclusion",
651
+ "Plain Text",
652
  ],
653
  value="Introduction, Body, Conclusion",
654
  label="Structure",
655
  elem_classes="input-highlight-turquoise",
656
+ interactive=True,
657
  )
658
  input_references = gr.Dropdown(
659
  choices=[
 
827
  ai_comments.change(regenerate_visible, inputs=output_article, outputs=regenerate_btn)
828
  ai_check_btn.click(highlight_visible, inputs=ai_detector_dropdown, outputs=highlighted_text)
829
 
830
+ input_format.change(fn=update_structure, inputs=input_format, outputs=input_structure)
831
+
832
  generate_btn.click(
833
  fn=generate_and_format,
834
  inputs=[