123456789101112131415161718192021222324252627 |
- """train model"""
- import streamlit as st
- from sqlalchemy.sql import text
- def create_table(conn):
- with conn.session as s:
- s.execute(text('CREATE TABLE IF NOT EXISTS test (position TEXT, finger_model TEXT, start_time DATETIME, owner_name TEXT, model_path TEXT);'))
- s.commit()
- def get_tests(conn, sub_name):
- tests = conn.query('select * from test where owner_name = :owner', ttl=0.05, params={'owner': sub_name})
- return tests
- def create_test(conn, test_form):
- with conn.session as s:
- s.execute(
- text('INSERT INTO test (position, finger_model, start_time, owner_name, model_path) VALUES (:position, :finger_model, :start_time, :owner_name, :model_path);'),
- params=dict(position=test_form['position'],
- finger_model=test_form['finger_model'],
- start_time=test_form['start_time'],
- owner_name=test_form['owner_name'],
- model_path=test_form['model_path'])
- )
- s.commit()
|