Commit 01e619d1 authored by Ota Mikusek's avatar Ota Mikusek
Browse files

Add frontend

parents
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
.PHONY: run venv

venv: .venv

.venv:
	python -m venv .venv
	. .venv/bin/activate ; pip install -r requirements.txt

run:
	. .venv/bin/activate ; python make_database.py
	. .venv/bin/activate ; python server.py
+2 −0
Original line number Diff line number Diff line
DATA_PATH = "."
PORT = 6130
+9 −0
Original line number Diff line number Diff line
import sqlite3
import os

import config

db = sqlite3.connect(os.path.abspath(config.DATA_PATH + "/database.db"))
db.execute("CREATE TABLE IF NOT EXISTS convert_log(timestart INT, prompt TEXT, cql TEXT, rating TEXT, model TEXT)").close()
db.commit()
db.close()
+10 −0
Original line number Diff line number Diff line
import requests
import urllib.parse

REMOTE_URI = "http://localhost:6284"

def call(prompt: str) -> str:
    prompt_uri = urllib.parse.quote_plus(prompt)
    response = requests.get(REMOTE_URI + "?method=cql_mt5&prompt=" + prompt_uri).text
    print(response)
    return response
+10 −0
Original line number Diff line number Diff line
import requests
import urllib.parse

REMOTE_URI = "http://localhost:6284"

def call(prompt: str) -> str:
    prompt_uri = urllib.parse.quote_plus(prompt)
    response = requests.get(REMOTE_URI + "?method=cql_mt5_g&prompt=" + prompt_uri).text
    print(response)
    return response