-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
30 lines (23 loc) · 975 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import click
from degree_inference.openai import OpenAIClient
from degree_inference.bigquery import BigQueryClient
@click.group()
def cli():
pass
@cli.command(help="Send unstructured data to GPT-4")
@click.option('--count', help='Number of degrees to infer.', required=True)
@click.option('--offset', help='Number of degrees to offset before beginning inference. Useful for resuming when something goes wrong.')
def gpt(count, offset):
from degree_inference.gpt import GPT
gpt = GPT(OpenAIClient(), BigQueryClient())
gpt.infer(n=int(count),offset=int(offset))
@cli.command(help="Run inference")
@click.option('--model', help='The path to the model', required=True)
@click.option('--input', help='The path to the inputs as a newline-separated file', required=True)
def infer(model, input):
from degree_inference import inference
f = open(input, "r")
xs = f.readlines()
print(inference.run(model,xs))
if __name__ == "__main__":
cli()