60 lines
1.7 KiB
HTML
60 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>AI Models</title>
|
|
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
|
|
|
|
</head>
|
|
<body>
|
|
<h2>Lista modeli AI</h2>
|
|
<div id="models-container">
|
|
{% for name, model in models.items() %}
|
|
<div class="model-card" id="model-{{name}}">
|
|
<h3>{{name}}</h3>
|
|
<div class="description">
|
|
{{ model.md_content | safe }}
|
|
</div>
|
|
|
|
|
|
<form class="predict-form">
|
|
{% for inp in model.inputs %}
|
|
<label>{{inp}}:</label>
|
|
<input name="{{inp}}"><br>
|
|
{% endfor %}
|
|
<button type="submit">Wyślij</button>
|
|
</form>
|
|
<div class="output" id="output-{{name}}"></div>
|
|
{% if model.meta.downloadable %}
|
|
<div class="download">
|
|
<a href="/download/{{name}}/model.py" target="_blank">Pobierz model.py</a> |
|
|
<a href="/download/{{name}}/description.md" target="_blank">Pobierz description.md</a> |
|
|
<a href="/download/{{name}}/meta.json" target="_blank">Pobierz meta.json</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<hr>
|
|
{% endfor %}
|
|
</div>
|
|
|
|
<script>
|
|
document.querySelectorAll(".predict-form").forEach(form => {
|
|
form.addEventListener("submit", async (e) => {
|
|
e.preventDefault();
|
|
const parent = e.target.closest(".model-card");
|
|
const modelName = parent.id.replace("model-", "");
|
|
const outputDiv = parent.querySelector(".output");
|
|
|
|
const formData = new FormData(form);
|
|
const response = await fetch(`/predict/${modelName}`, {
|
|
method: "POST",
|
|
body: formData
|
|
});
|
|
|
|
const data = await response.json();
|
|
outputDiv.textContent = data.output;
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|