HelloImSteven commited on
Commit
7f1658f
·
1 Parent(s): 00c32c2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -5
README.md CHANGED
@@ -8,13 +8,64 @@ tags:
8
  - applescript
9
  - code
10
  widget:
11
- - text: on openFile(filePath, permission)
12
- example_title: Handler Definition
13
- - text: on openFile(filePath, permission)
14
- example_title: Handler Definition
 
 
 
 
 
 
 
 
15
  pipeline_tag: summarization
16
  ---
17
 
18
  # Model Description
19
 
20
- # Usage
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  - applescript
9
  - code
10
  widget:
11
+ - text: "on openFile(filePath, permission)"
12
+ example_title: "Handler Definition"
13
+ - text: "set myVar to 3"
14
+ example_title: "Set Variable"
15
+ - text: "open location \"https://huggingface.co\""
16
+ example_title: "open location"
17
+ - text: "do shell script \"echo 'Here are some numbers: 1, 5, 89, 156, 1053' | egrep -o '\\d*'\""
18
+ example_title: "do shell script"
19
+ - text: "use framework \"CoreLocation\""
20
+ example_title: "use framework"
21
+ - text: "tell application \"Notes\" to make new note"
22
+ example_title: "Make New Note"
23
  pipeline_tag: summarization
24
  ---
25
 
26
  # Model Description
27
 
28
+ This model summarizes individual lines of AppleScript code and provides insights into their purpose and functionality. The model is trained on the [applescript-lines-annotated](https://huggingface.co/datasets/HelloImSteven/applescript-lines-annotated) dataset.
29
+
30
+ # Usage
31
+
32
+ ```python
33
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM, AutoConfig, pipeline
34
+
35
+ model_selector = "HelloImSteven/AppleScript-Summarizer"
36
+ tokenizer = AutoTokenizer.from_pretrained(model_selector)
37
+
38
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_selector)
39
+ config = AutoConfig.from_pretrained(model_selector)
40
+
41
+ pipe = pipeline("summarization", model=model, config=config, tokenizer=tokenizer)
42
+
43
+ raw_code = [
44
+ "if myThing is 0 then set success to true",
45
+ "set numInputs to 5",
46
+ "tell application \"System Events\" to click button \"OK\" of window 1 of application process \"Finder\""
47
+ ]
48
+
49
+ res = pipe(raw_code)
50
+ for i in range(len(res)):
51
+ print("\n\nInput: '" + raw_code[i] + "'")
52
+ print("\nSummary: " + res[i]["summary_text"] + '\n')
53
+ ```
54
+
55
+ The model performs best when given adequate context, such as meaningful variable and handler names. For example, it will perform better when provided the input "on makeDirectory(dirPath)" than it will for "on makeDir(x)".
56
+
57
+ # Limitations
58
+
59
+ This model is a work in progress. It is trained on a small dataset of annotated AppleScript lines, but that dataset will grow in time. For now, however, this leads to several limitations of the model:
60
+
61
+ 1. There are concepts and line structures that are simply absent from the dataset, so the model will struggle with them. If you identify such a concept, please consider providing feedback (e.g. expected output).
62
+ 2. While the model is fine-tuned from Bart and thus has adequate knowledge of outside concepts, it is not able to give explanations of all possible concepts. For example, for inputs involving the `do shell script` command, it will be able to provide explanations of some shell scripts better than others. This is not an area of focus for this model, so do not expect significant improvements in future versions.
63
+ 3. This is not a conversational model.
64
+
65
+ # Example Outputs
66
+
67
+ | Input | Output |
68
+ | ----- | ----- |
69
+ | on makeDirectory(dirPath) | This is a line of AppleScript code that begins the definition of the handler "makeDirectory". The handler takes a single parameter, "dirPath", which is the path to the directory to be made available to the user. When executed, this line will open the directory specified by the variable dirPath. |
70
+ | open location "https://apple.com" | This line calls the "open location" handler of the "AppleScript" application, passing the URL "https://apple.com" as an argument. The "open" handler opens the application's web page and brings it to the front. This line must be within a "tell" block that specifies the target application. |
71
+ | do shell script "open -a 'Google Chrome'" | This runs a shell script using the "do shell script" handler, providing the text "open -a 'Google Chrome'" as the script to be executed. When executed, this will open the Chrome application in Finder. |