Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 17d66b7

Browse files
committedJan 26, 2023
Fix .gitignore
1 parent c3e6565 commit 17d66b7

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed
 

‎.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
/javascript
21
/style.css

‎javascript/hints.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//Basically copied this from AUTOMATIC1111 implementation of the main UI
2+
3+
titles = {
4+
"Temperature": "A higher temperature will produce more diverse results, but with a higher risk of less coherent text",
5+
"Max Length": "The maximum number of tokens for the output of the model",
6+
"Top K": "Strategy is to sample from a shortlist of the top K tokens. This approach allows the other high-scoring tokens a chance of being picked.",
7+
"Repetition Penalty": "The parameter for repetition penalty. 1.0 means no penalty. Default setting is 1.2. Paper explaining it is linked to Github's readme",
8+
"How Many To Generate":"The number of results to generate. Not guaranteed if models fails to create them",
9+
"Generate Using Magic Prompt":"Be aware that sometimes the model fails to produce anything or less than the wanted amount, either try again or use a new prompt in that case"
10+
}
11+
12+
onUiUpdate(function(){
13+
gradioApp().querySelectorAll('span, button, select, p').forEach(function(span){
14+
tooltip = titles[span.textContent];
15+
16+
if(!tooltip){
17+
tooltip = titles[span.value];
18+
}
19+
20+
if(!tooltip){
21+
for (const c of span.classList) {
22+
if (c in titles) {
23+
tooltip = titles[c];
24+
break;
25+
}
26+
}
27+
}
28+
29+
if(tooltip){
30+
span.title = tooltip;
31+
}
32+
})
33+
34+
gradioApp().querySelectorAll('select').forEach(function(select){
35+
if (select.onchange != null) return;
36+
37+
select.onchange = function(){
38+
select.title = titles[select.value] || "";
39+
}
40+
})
41+
})

1 commit comments

Comments
 (1)

imrayya commented on Jan 26, 2023

@imrayya
OwnerAuthor

Added tooltips to address issue: #10

Please sign in to comment.