aboutsummaryrefslogtreecommitdiff
path: root/gn3/api/gemma.py
blob: 1a7232d10c2141ebacf575ff84628278e29b03f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Endpoints for running the gemma cmd"""
from flask import Blueprint
from flask import current_app
from flask import jsonify

from gn3.commands import run_cmd

gemma = Blueprint("gemma", __name__)


@gemma.route("/version")
def get_version():
    """Display the installed version of gemma-wrapper"""
    gemma_cmd = current_app.config['APP_DEFAULTS'].get('GEMMA_WRAPPER_CMD')
    return jsonify(
        run_cmd(f"{gemma_cmd} -v | head -n 1"))