Update app.py
Browse files
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 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
475 |
-
|
476 |
-
|
477 |
-
|
478 |
-
|
479 |
-
|
480 |
-
|
481 |
-
|
482 |
-
|
483 |
-
|
484 |
-
|
485 |
-
|
486 |
-
|
487 |
-
|
488 |
-
|
489 |
-
|
490 |
-
|
491 |
-
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
503 |
-
|
504 |
-
|
505 |
-
|
506 |
-
|
507 |
-
|
508 |
-
|
509 |
-
|
510 |
-
|
511 |
-
|
512 |
-
|
513 |
-
|
514 |
-
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
|
520 |
-
|
521 |
-
|
522 |
-
|
523 |
-
|
524 |
-
|
525 |
-
|
526 |
-
|
527 |
-
|
528 |
-
|
529 |
-
|
530 |
-
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
-
|
535 |
-
|
536 |
-
|
537 |
-
|
538 |
-
|
539 |
-
|
540 |
-
|
541 |
-
|
542 |
-
|
543 |
-
|
544 |
-
|
545 |
-
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
|
554 |
-
|
555 |
-
|
556 |
-
|
557 |
|
558 |
-
|
559 |
-
|
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(
|