Severian commited on
Commit
799b4bb
·
verified ·
1 Parent(s): 57b6904

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +88 -90
app.py CHANGED
@@ -463,100 +463,98 @@ with gr.Blocks(theme="Hev832/Applio", css=css) as demo:
463
  2. **Choose Your Output**: Select from descriptive captions, training prompts, or tags.
464
  3. **Customize the Results**: Adjust tone, length, and other parameters to fine-tune the output.
465
  4. **Generate and Iterate**: Click 'Caption' to analyze your image and use the results to inspire new creations.
466
-
467
- <h6><center>JoyCaption Alpha One</center></h6>
468
  """
469
  )
470
 
471
- with gr.Tab("JoyCaption"):
472
- gr.Markdown("""
473
- # JoyCaption: AI-Powered Image Analysis Tool
474
-
475
- This tool helps you generate various types of text based on an uploaded image. Here's how to use it:
476
-
477
- 1. Upload an image
478
- 2. Choose your desired output type
479
- 3. Adjust settings as needed
480
- 4. Click 'Generate Caption' to get your result
481
- """)
482
-
483
- with gr.Row():
484
- with gr.Column(scale=1):
485
- input_image = gr.Image(type="pil", label="Upload Your Image")
486
-
487
- caption_type = gr.Dropdown(
488
- choices=[
489
- "descriptive",
490
- "training_prompt",
491
- "rng-tags",
492
- "thematic_analysis",
493
- "stylistic_comparison",
494
- "narrative_suggestion",
495
- "contextual_storytelling",
496
- "style_prompt"
497
- ],
498
- label="Output Type",
499
- value="descriptive",
500
- )
501
-
502
- gr.Markdown("""
503
- ### Output Types Explained:
504
- - **Descriptive**: A general description of the image
505
- - **Training Prompt**: A prompt for AI image generation
506
- - **RNG-Tags**: Tags for categorizing the image
507
- - **Thematic Analysis**: Exploration of themes in the image
508
- - **Stylistic Comparison**: Compares the image to art styles
509
- - **Narrative Suggestion**: A story idea based on the image
510
- - **Contextual Storytelling**: A background story for the image
511
- - **Style Prompt**: Analyzes the image in context of a specific art style
512
- """)
513
-
514
- caption_tone = gr.Dropdown(
515
- choices=["formal", "informal"],
516
- label="Tone",
517
- value="formal",
518
- )
519
-
520
- gr.Markdown("Choose between a formal (professional) or informal (casual) tone for the output.")
521
-
522
- caption_length = gr.Dropdown(
523
- choices=["any", "very short", "short", "medium-length", "long", "very long"] +
524
- [str(i) for i in range(20, 261, 10)],
525
- label="Length",
526
- value="any",
527
- )
528
-
529
- gr.Markdown("""
530
- Select the desired length of the output:
531
- - 'any': No specific length
532
- - Descriptive options: very short to very long
533
- - Numeric options: Specify exact word count (20 to 260 words)
534
- """)
535
-
536
- art_style = gr.Dropdown(
537
- choices=ART_STYLES,
538
- label="Art Style (for Style Prompt)",
539
- value="Impressionism",
540
- visible=False
541
- )
542
-
543
- gr.Markdown("Select an art style to analyze the image in that context. Only applicable for 'Style Prompt' output type.")
544
-
545
- with gr.Column(scale=1):
546
- output_caption = gr.Textbox(label="Generated Output", lines=10)
547
- generate_button = gr.Button("Generate Caption")
548
-
549
- gr.Markdown("""
550
- ### Additional Notes:
551
- - The 'Tone' setting doesn't affect 'RNG-Tags' and 'Training Prompt' outputs.
552
- - 'Art Style' is only used when 'Style Prompt' is selected as the output type.
553
- - The AI model analyzes the image and generates text based on your selections.
554
- """)
555
-
556
- run_button = gr.Button("Caption")
557
 
558
- with gr.Column():
559
- output_caption = gr.Textbox(label="Caption")
560
 
561
 
562
  caption_type.change(
 
463
  2. **Choose Your Output**: Select from descriptive captions, training prompts, or tags.
464
  3. **Customize the Results**: Adjust tone, length, and other parameters to fine-tune the output.
465
  4. **Generate and Iterate**: Click 'Caption' to analyze your image and use the results to inspire new creations.
 
 
466
  """
467
  )
468
 
469
+ with gr.Tab("JoyCaption"):
470
+ gr.Markdown("""
471
+ # JoyCaption: AI-Powered Image Analysis Tool
472
+
473
+ This tool helps you generate various types of text based on an uploaded image. Here's how to use it:
474
+
475
+ 1. Upload an image
476
+ 2. Choose your desired output type
477
+ 3. Adjust settings as needed
478
+ 4. Click 'Generate Caption' to get your result
479
+ """)
480
+
481
+ with gr.Row():
482
+ with gr.Column(scale=1):
483
+ input_image = gr.Image(type="pil", label="Upload Your Image")
484
+
485
+ caption_type = gr.Dropdown(
486
+ choices=[
487
+ "descriptive",
488
+ "training_prompt",
489
+ "rng-tags",
490
+ "thematic_analysis",
491
+ "stylistic_comparison",
492
+ "narrative_suggestion",
493
+ "contextual_storytelling",
494
+ "style_prompt"
495
+ ],
496
+ label="Output Type",
497
+ value="descriptive",
498
+ )
499
+
500
+ gr.Markdown("""
501
+ ### Output Types Explained:
502
+ - **Descriptive**: A general description of the image
503
+ - **Training Prompt**: A prompt for AI image generation
504
+ - **RNG-Tags**: Tags for categorizing the image
505
+ - **Thematic Analysis**: Exploration of themes in the image
506
+ - **Stylistic Comparison**: Compares the image to art styles
507
+ - **Narrative Suggestion**: A story idea based on the image
508
+ - **Contextual Storytelling**: A background story for the image
509
+ - **Style Prompt**: Analyzes the image in context of a specific art style
510
+ """)
511
+
512
+ caption_tone = gr.Dropdown(
513
+ choices=["formal", "informal"],
514
+ label="Tone",
515
+ value="formal",
516
+ )
517
+
518
+ gr.Markdown("Choose between a formal (professional) or informal (casual) tone for the output.")
519
+
520
+ caption_length = gr.Dropdown(
521
+ choices=["any", "very short", "short", "medium-length", "long", "very long"] +
522
+ [str(i) for i in range(20, 261, 10)],
523
+ label="Length",
524
+ value="any",
525
+ )
526
+
527
+ gr.Markdown("""
528
+ Select the desired length of the output:
529
+ - 'any': No specific length
530
+ - Descriptive options: very short to very long
531
+ - Numeric options: Specify exact word count (20 to 260 words)
532
+ """)
533
+
534
+ art_style = gr.Dropdown(
535
+ choices=ART_STYLES,
536
+ label="Art Style (for Style Prompt)",
537
+ value="Impressionism",
538
+ visible=False
539
+ )
540
+
541
+ gr.Markdown("Select an art style to analyze the image in that context. Only applicable for 'Style Prompt' output type.")
542
+
543
+ with gr.Column(scale=1):
544
+ output_caption = gr.Textbox(label="Generated Output", lines=10)
545
+ generate_button = gr.Button("Generate Caption")
546
+
547
+ gr.Markdown("""
548
+ ### Additional Notes:
549
+ - The 'Tone' setting doesn't affect 'RNG-Tags' and 'Training Prompt' outputs.
550
+ - 'Art Style' is only used when 'Style Prompt' is selected as the output type.
551
+ - The AI model analyzes the image and generates text based on your selections.
552
+ """)
553
+
554
+ run_button = gr.Button("Caption")
555
 
556
+ with gr.Column():
557
+ output_caption = gr.Textbox(label="Caption")
558
 
559
 
560
  caption_type.change(