712c556032
- Updated `refresh_models_cache` to include output modalities in the models cache. - Added `get_model_output_modalities` function to retrieve output modalities for a specific model. - Modified tests to cover new functionality for output modalities. - Updated OpenRouter video generation functions to support audio generation and improved error handling. - Enhanced dashboard to display generated images and videos. - Refactored frontend templates to accommodate new data structures for generated content. - Adjusted tests to validate changes in model handling and dashboard rendering. Co-authored-by: Copilot <copilot@github.com>
82 lines
3.6 KiB
HTML
82 lines
3.6 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Image Generation — All You Can GET AI{% endblock %}
|
|
{% block content %}
|
|
<div class="card">
|
|
<h1>Image Generation</h1>
|
|
<form method="post" enctype="multipart/form-data">
|
|
<label for="model">Model</label>
|
|
{% if models %}
|
|
<select id="model" name="model" required>
|
|
{% for m in models %}
|
|
<option value="{{ m.id }}" {{ "selected" if request.form.get('model', '') == m.id else "" }}>{{ m.name }}</option>
|
|
{% endfor %}
|
|
</select>
|
|
{% else %}
|
|
<input id="model" name="model" type="text" required
|
|
placeholder="e.g. google/gemini-2.5-flash-image"
|
|
value="{{ request.form.get('model', '') }}">
|
|
{% endif %}
|
|
|
|
<label for="prompt">Prompt</label>
|
|
<textarea id="prompt" name="prompt" rows="4" required
|
|
placeholder="Describe the image you want…">{{ request.form.get('prompt', '') }}</textarea>
|
|
|
|
<label for="aspect_ratio">Aspect ratio</label>
|
|
<select id="aspect_ratio" name="aspect_ratio">
|
|
<option value="">Auto (default 1:1)</option>
|
|
<option value="1:1" {{ "selected" if request.form.get('aspect_ratio')=='1:1' else "" }}>1:1 (square)</option>
|
|
<option value="16:9" {{ "selected" if request.form.get('aspect_ratio')=='16:9' else "" }}>16:9 (landscape)</option>
|
|
<option value="9:16" {{ "selected" if request.form.get('aspect_ratio')=='9:16' else "" }}>9:16 (portrait)</option>
|
|
<option value="4:3" {{ "selected" if request.form.get('aspect_ratio')=='4:3' else "" }}>4:3</option>
|
|
<option value="3:4" {{ "selected" if request.form.get('aspect_ratio')=='3:4' else "" }}>3:4</option>
|
|
<option value="3:2" {{ "selected" if request.form.get('aspect_ratio')=='3:2' else "" }}>3:2</option>
|
|
<option value="2:3" {{ "selected" if request.form.get('aspect_ratio')=='2:3' else "" }}>2:3</option>
|
|
</select>
|
|
|
|
<label for="image_size">Resolution</label>
|
|
<select id="image_size" name="image_size">
|
|
<option value="">Auto (default 1K)</option>
|
|
<option value="0.5K" {{ "selected" if request.form.get('image_size')=='0.5K' else "" }}>0.5K (low)</option>
|
|
<option value="1K" {{ "selected" if request.form.get('image_size')=='1K' else "" }}>1K (standard)</option>
|
|
<option value="2K" {{ "selected" if request.form.get('image_size')=='2K' else "" }}>2K (high)</option>
|
|
<option value="4K" {{ "selected" if request.form.get('image_size')=='4K' else "" }}>4K (ultra)</option>
|
|
</select>
|
|
|
|
<label for="reference_image">Reference image (optional)</label>
|
|
<input
|
|
id="reference_image"
|
|
name="reference_image"
|
|
type="file"
|
|
accept="image/png,image/jpeg,image/webp,image/gif"
|
|
>
|
|
<p class="text-muted mt-1" id="reference-image-help">
|
|
Upload an image to use as visual reference (image-to-image).
|
|
</p>
|
|
<div class="image-upload-preview" id="image-upload-preview" hidden>
|
|
<p class="text-muted" id="image-upload-filename"></p>
|
|
<img id="image-upload-preview-img" alt="Uploaded reference image preview" class="generated-image">
|
|
</div>
|
|
|
|
<button type="submit">Generate image</button>
|
|
</form>
|
|
|
|
{% if error %}
|
|
<div class="alert alert-error mt-2">{{ error }}</div>
|
|
{% endif %}
|
|
|
|
{% if result %}
|
|
<div class="result">
|
|
<h2>Generated image{{ 's' if result.images|length > 1 }}</h2>
|
|
{% for img in result.images %}
|
|
{% if img.url %}
|
|
<img src="{{ img.url }}" alt="Generated image" class="generated-image">
|
|
{% endif %}
|
|
{% if img.revised_prompt %}
|
|
<p class="text-muted mt-1" style="font-size:0.8rem;">{{ img.revised_prompt }}</p>
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|