48 lines
1.5 KiB
HTML
48 lines
1.5 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Generate — AI Allucanget{% endblock %}
|
|
{% block content %}
|
|
<div class="card">
|
|
<h1>Generate</h1>
|
|
<form method="post">
|
|
<label for="type">Type</label>
|
|
<select id="type" name="type">
|
|
<option value="text">Text</option>
|
|
<option value="image">Image</option>
|
|
<option value="video">Video</option>
|
|
</select>
|
|
|
|
<label for="model">Model</label>
|
|
<input id="model" name="model" type="text" required placeholder="e.g. openai/gpt-4o">
|
|
|
|
<label for="prompt">Prompt</label>
|
|
<textarea id="prompt" name="prompt" rows="4" required placeholder="Describe what you want…"></textarea>
|
|
|
|
<button type="submit">Generate</button>
|
|
</form>
|
|
|
|
{% if error %}
|
|
<div class="alert alert-error">{{ error }}</div>
|
|
{% endif %}
|
|
|
|
{% if result %}
|
|
<div class="result">
|
|
{% if result.get('content') %}
|
|
<h2>Result</h2>
|
|
<pre>{{ result.content }}</pre>
|
|
{% elif result.get('images') %}
|
|
<h2>Generated image{{ 's' if result.images|length > 1 }}</h2>
|
|
{% for img in result.images %}
|
|
<img src="{{ img.url }}" alt="Generated image" class="generated-image">
|
|
{% endfor %}
|
|
{% elif result.get('status') %}
|
|
<h2>Video job</h2>
|
|
<p>Status: <strong>{{ result.status }}</strong></p>
|
|
{% if result.get('video_url') %}
|
|
<video src="{{ result.video_url }}" controls class="generated-video"></video>
|
|
{% endif %}
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
{% endblock %}
|