mirror of
https://github.com/mudler/LocalAI.git
synced 2025-12-27 16:39:16 -05:00
* feat(agent-jobs): add multimedia support Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * Refactoring Signed-off-by: Ettore Di Giacinto <mudler@localai.io> --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
129 lines
6.2 KiB
HTML
129 lines
6.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
{{template "views/partials/head" .}}
|
|
<script defer src="static/image.js"></script>
|
|
|
|
<body class="bg-[var(--color-bg-primary)] text-[var(--color-text-primary)]">
|
|
<div class="flex flex-col min-h-screen">
|
|
|
|
{{template "views/partials/navbar" .}}
|
|
<div class="container mx-auto px-4 py-8 flex-grow" x-data="{ component: 'menu' }">
|
|
|
|
<!-- Hero Section -->
|
|
<div class="hero-section">
|
|
<div class="hero-content">
|
|
<h1 class="hero-title">
|
|
Image Generation {{ if .Model }} with {{.Model}} {{ end }}
|
|
</h1>
|
|
<p class="hero-subtitle">Create stunning images from text descriptions</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Model Selection - Positioned between hero and generation form -->
|
|
<div class="card p-5 mb-6">
|
|
<div class="flex items-center">
|
|
<div class="text-lg font-medium text-[var(--color-primary)] mr-4">
|
|
<i class="fas fa-palette mr-2"></i>Select Model:
|
|
</div>
|
|
<div class="flex-grow">
|
|
<select x-data="{ link : '' }" x-model="link" x-init="$watch('link', value => window.location = link)"
|
|
id="model-select"
|
|
class="input w-full max-w-md p-2.5 pr-10"
|
|
>
|
|
<option value="" disabled class="text-[var(--color-text-secondary)]">Select a model</option>
|
|
{{ $model:=.Model}}
|
|
{{ range .ModelsConfig }}
|
|
{{ $cfg := . }}
|
|
{{ range .KnownUsecaseStrings }}
|
|
{{ if eq . "FLAG_IMAGE" }}
|
|
<option value="text2image/{{$cfg.Name}}" {{ if eq $cfg.Name $model }} selected {{end}} class="bg-[var(--color-bg-primary)] text-[var(--color-text-primary)]">{{$cfg.Name}}</option>
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ end }}
|
|
{{ range .ModelsWithoutConfig }}
|
|
<option value="text2image/{{.}}" {{ if eq . $model }} selected {{ end }} class="bg-[var(--color-bg-primary)] text-[var(--color-text-primary)]">{{.}}</option>
|
|
{{end}}
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Image Generation Form -->
|
|
<div class="card p-6">
|
|
<h2 class="h3 mb-6">Generate an Image</h2>
|
|
|
|
<div class="relative">
|
|
<input id="image-model" type="hidden" value="{{.Model}}">
|
|
<form id="genimage" action="text2image/{{.Model}}" method="get" class="mb-8">
|
|
<div class="relative">
|
|
<div class="absolute inset-y-0 left-0 flex items-center pl-4 pointer-events-none z-10">
|
|
<i class="fas fa-magic text-[var(--color-primary)]"></i>
|
|
</div>
|
|
<input
|
|
type="text"
|
|
id="input"
|
|
name="input"
|
|
placeholder="Describe the image you want to generate..."
|
|
autocomplete="off"
|
|
class="input w-full pr-12 py-4 text-lg"
|
|
style="padding-left: 3.5rem !important;"
|
|
required
|
|
/>
|
|
<span id="loader" class="my-2 loader absolute right-4 top-4 hidden">
|
|
<svg class="animate-spin h-6 w-6 text-[var(--color-primary)]" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
|
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
<path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
|
|
</svg>
|
|
</span>
|
|
</div>
|
|
|
|
<!-- Size Selection -->
|
|
<div class="mt-4">
|
|
<label for="image-size" class="block text-sm font-medium text-[var(--color-text-secondary)] mb-2">
|
|
<i class="fas fa-expand-arrows-alt mr-2 text-[var(--color-primary)]"></i>Image Size:
|
|
</label>
|
|
<input
|
|
type="text"
|
|
id="image-size"
|
|
value="256x256"
|
|
placeholder="e.g., 256x256, 512x512, 1024x1024"
|
|
class="input p-2.5 w-full max-w-xs"
|
|
/>
|
|
</div>
|
|
|
|
<!-- Submit Button -->
|
|
<div class="mt-6">
|
|
<button
|
|
type="submit"
|
|
class="btn-primary w-full"
|
|
>
|
|
<i class="fas fa-magic mr-2"></i>Generate Image
|
|
</button>
|
|
</div>
|
|
</form>
|
|
|
|
<!-- Image Results Container -->
|
|
<div class="mt-6 border-t border-[#1E293B] pt-6">
|
|
<h3 class="text-xl font-semibold text-[var(--color-text-primary)] mb-4">Generated Image</h3>
|
|
<div class="container mx-auto flex justify-center">
|
|
<div id="result" class="mx-auto bg-[var(--color-bg-primary)]/50 border border-[#1E293B] rounded-xl p-4 min-h-[300px] w-full flex items-center justify-center">
|
|
<p class="text-[var(--color-text-secondary)] italic">Your generated image will appear here</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{template "views/partials/footer" .}}
|
|
</div>
|
|
|
|
<script>
|
|
// Show loader when form is submitted
|
|
document.getElementById('genimage').addEventListener('submit', function() {
|
|
document.getElementById('loader').classList.remove('hidden');
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html> |