Spaces:
Sleeping
Sleeping
smellslikeml
commited on
Commit
•
d00631c
1
Parent(s):
a74e89c
removed extra deps
Browse files- README.md +1 -1
- requirements.txt +0 -1
- sheet_extractor.py +0 -38
README.md
CHANGED
@@ -16,6 +16,6 @@ Please configure your OpenAI API key as an environment variable:
|
|
16 |
```
|
17 |
export OPENAI_API_KEY="yout-key-here"
|
18 |
```
|
19 |
-
And ensure you have your `
|
20 |
|
21 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
16 |
```
|
17 |
export OPENAI_API_KEY="yout-key-here"
|
18 |
```
|
19 |
+
And ensure you have your `token.json` in your working directory. More info [here](https://developers.google.com/sheets/api/quickstart/python)
|
20 |
|
21 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
requirements.txt
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
openai
|
2 |
ortools
|
3 |
requests
|
4 |
gspread
|
|
|
|
|
1 |
ortools
|
2 |
requests
|
3 |
gspread
|
sheet_extractor.py
CHANGED
@@ -2,49 +2,11 @@ import math
|
|
2 |
import json
|
3 |
import regex
|
4 |
import inspect
|
5 |
-
import gspread
|
6 |
-
import guidance
|
7 |
from ast import literal_eval
|
8 |
from transformers import Tool
|
9 |
-
from oauth2client.service_account import ServiceAccountCredentials
|
10 |
-
from googleapiclient.discovery import build
|
11 |
-
from google.oauth2.credentials import Credentials
|
12 |
|
13 |
-
from google.auth.transport.requests import Request
|
14 |
from google.oauth2.credentials import Credentials
|
15 |
-
from google_auth_oauthlib.flow import InstalledAppFlow
|
16 |
from googleapiclient.discovery import build
|
17 |
-
from googleapiclient.errors import HttpError
|
18 |
-
|
19 |
-
from ortools.linear_solver import pywraplp
|
20 |
-
|
21 |
-
guidance.llm = guidance.llms.OpenAI("gpt-4")
|
22 |
-
|
23 |
-
|
24 |
-
structure_program = guidance(
|
25 |
-
'''
|
26 |
-
{{#user~}}
|
27 |
-
{{description}}
|
28 |
-
Help me extract args from the data blob to apply the following algorithm:
|
29 |
-
{{code}}
|
30 |
-
|
31 |
-
----
|
32 |
-
|
33 |
-
{{~#each examples}}
|
34 |
-
Data Blob: {{this.input}}
|
35 |
-
Result: {{this.output}}
|
36 |
-
---
|
37 |
-
{{~/each}}
|
38 |
-
|
39 |
-
Please help me extract the input values from a given data blob into a JSON.
|
40 |
-
Data Blob: {{data_blob}}
|
41 |
-
Result:
|
42 |
-
{{~/user}}
|
43 |
-
|
44 |
-
{{#assistant~}}
|
45 |
-
{{gen 'output'}}
|
46 |
-
{{~/assistant}}
|
47 |
-
''')
|
48 |
|
49 |
|
50 |
class DataExtractorTool(Tool):
|
|
|
2 |
import json
|
3 |
import regex
|
4 |
import inspect
|
|
|
|
|
5 |
from ast import literal_eval
|
6 |
from transformers import Tool
|
|
|
|
|
|
|
7 |
|
|
|
8 |
from google.oauth2.credentials import Credentials
|
|
|
9 |
from googleapiclient.discovery import build
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
|
12 |
class DataExtractorTool(Tool):
|