Skip to content

Commit

Permalink
Dashboard Info (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbengfort authored Oct 4, 2024
1 parent a329563 commit b110187
Show file tree
Hide file tree
Showing 3 changed files with 170 additions and 3 deletions.
12 changes: 12 additions & 0 deletions parlance/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

from django.shortcuts import render
from django.views.generic import TemplateView
from parley.models import LLM, Evaluation, Prompt, Response


##########################################################################
Expand All @@ -32,6 +33,17 @@ class Dashboard(TemplateView):
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['page_id'] = "dashboard"

# Get statistics for stat cards
context['n_llms'] = LLM.objects.count()
context["n_evaluations"] = Evaluation.objects.count()
context["n_prompts"] = Prompt.objects.count()
context["n_responses"] = Response.objects.count()

# Get evaluations and models
context["evaluations"] = Evaluation.objects.filter(active=True)
context["llms"] = LLM.objects.all()[:20]

return context


Expand Down
22 changes: 22 additions & 0 deletions templates/components/statcard.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="card">
<div class="card-body">
<div class="row align-items-center gx-0">
<div class="col">

<!-- title -->
<h6 class="text-uppercase text-muted mb-2">
{{ title }}
</h6>

<span class="h2 mb-0">
{{ value }}
</span>
</div>
<!-- icon -->
<div class="col-auto">
<span class="h2 fe {{ icon }} text-muted mb-0"></span>
</div>

</div>
</div>
</div>
139 changes: 136 additions & 3 deletions templates/site/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ <h1 class="header-title">
</div>

<div class="col-auto">
<a href="#!" class="btn btn-primary lift">
Create Report
</a>
<!-- add dashboard control buttons here -->
</div>
</div>
</div>
Expand All @@ -32,6 +30,141 @@ <h1 class="header-title">
{% block page %}
<!-- page content -->
<div class="container-fluid">

<!-- cards -->
<div class="row">
<div class="col-12 col-lg-6 col-xl">
{% include "components/statcard.html" with title="LLMs" value=n_llms icon="fe-cpu" %}
</div>
<div class="col-12 col-lg-6 col-xl">
{% include "components/statcard.html" with title="Evaluations" value=n_evaluations icon="fe-clipboard" %}
</div>
<div class="col-12 col-lg-6 col-xl">
{% include "components/statcard.html" with title="Prompts" value=n_prompts icon="fe-file-plus" %}
</div>
<div class="col-12 col-lg-6 col-xl">
{% include "components/statcard.html" with title="Responses" value=n_responses icon="fe-message-square" %}
</div>
</div><!-- cards ends -->

<!-- evaluations list -->
<div class="row">
<div class="col-12">

<div class="card" data-list='{"valueNames": ["name"]}'>
<div class="card-header">
<h4 class="card-header-title">
Active Evaluations
</h4>

</div>
<div class="card-body">
<ul class="list-group list-group-lg list-group-flush list my-n4">
{% for evaluation in evaluations %}
<li class="list-group-item">
<div class="row align-items-center">
<div class="col-auto">
<!-- icon -->
<a href="#!" class="avatar avatar-lg">
<span class="avatar-title rounded bg-white text-secondary">
<span class="fe fe-clipboard"></span>
</span>
</a>
</div>
<div class="col ms-n2">

<!-- Title -->
<h4 class="mb-1 name">
<a href="#!">{{ evaluation.name }}</a>
</h4>

<!-- Text -->
<p class="card-text small text-muted mb-1">
{{ evaluation.task }}
</p>

<!-- Time -->
<p class="card-text small text-muted">
{{ evaluation.prompts.count }} prompts
</p>

</div>
<div class="col-auto">

<!-- Button -->
<a href="#!" class="btn btn-sm btn-white d-none d-md-inline-block">
Download
</a>

</div>
<div class="col-auto">

<!-- Dropdown -->
<div class="dropdown">
<a href="#" class="dropdown-ellipses dropdown-toggle" role="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fe fe-more-vertical"></i>
</a>
<div class="dropdown-menu dropdown-menu-end">
<a href="#!" class="dropdown-item">
Action
</a>
<a href="#!" class="dropdown-item">
Another action
</a>
<a href="#!" class="dropdown-item">
Something else here
</a>
</div>
</div>

</div>
</div>
</li>
{% empty %}
<li class="list-group-item">

</li>
{% endfor %}
</ul>
</div>
</div>

</div>
</div><!-- evaluations list ends -->

<!-- llm model list -->
<div class="row">
<div class="col-12">

<div class="card">
<div class="card-header">
<h4 class="card-header-title">LLM Models</h4>
</div>

<div class="table-responsive mb-0">
<table class="table table-sm table-nowrap card-table">
<thead>
<tr>
<th>Name</th>
<th class="text-center">Type</th>
<th class="text-center">Responses</th>
</tr>
</thead>
<tbody>
{% for model in llms %}
<tr>
<td>{{model.name}} <span class="badge bg-dark ms-auto">v{{ model.version }}</span></td>
<td class="text-center">{% if model.is_adapter_model %}LoRA{% else %}Base{% endif %}</td>
<td class="text-center">{{model.responses.count}}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>

</div>
</div><!-- llm model list ends -->
</div><!-- page content ends -->
{% endblock %}
{% endblock %}

0 comments on commit b110187

Please sign in to comment.