Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Megatron-LM
Commits
42982fc3
Commit
42982fc3
authored
Feb 03, 2022
by
rprenger
Browse files
Adding the web interface
parent
31fd62d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
121 additions
and
0 deletions
+121
-0
megatron/static/index.html
megatron/static/index.html
+121
-0
No files found.
megatron/static/index.html
0 → 100644
View file @
42982fc3
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
/>
<title>
Megatron
</title>
<style>
.wrapper
{
max-width
:
75%
;
margin
:
auto
;
}
h1
{
margin
:
3rem
0
1rem
0
;
padding
:
0
;
font-size
:
1.5rem
;
}
textarea
{
width
:
100%
;
min-height
:
300px
;
resize
:
none
;
border-radius
:
8px
;
border
:
1px
solid
#ddd
;
padding
:
0.5rem
;
box-shadow
:
inset
0
0
0.25rem
#ddd
;
&:focus
{
outline
:
none
;
border
:
1px
solid
darken
(
#ddd
,
5%
);
box-shadow
:
inset
0
0
0.5rem
darken
(
#ddd
,
5%
);
}
}
#the-count
{
float
:
right
;
padding
:
0.1rem
0
0
0
;
font-size
:
0.875rem
;
}
/* Chat containers */
.container
{
font-family
:
'Arial'
,
sans-serif
;
font-size
:
16px
;
border
:
2px
solid
#dedede
;
background-color
:
#f1f1f1
;
border-radius
:
5px
;
padding
:
15px
;
margin
:
10px
0
;
}
/* Clear floats */
.container
::after
{
content
:
""
;
clear
:
both
;
display
:
table
;
}
/* Style images */
.container
img
{
float
:
left
;
max-width
:
60px
;
width
:
100%
;
margin-right
:
20px
;
border-radius
:
50%
;
}
</style>
</head>
<body>
<div
class=
"wrapper"
>
<h1>
Prompt Megatron
</h1>
<textarea
name=
"prompt"
id=
"prompt"
maxlength=
"1024"
placeholder=
"Add prompt"
autofocus
></textarea>
<label
for=
"tokens_to_generate"
>
Number tokens to generate (1-1024):
</label>
<input
type=
"number"
id=
"tokens_to_generate"
name=
"tokens_to_generate"
min=
"10"
max=
"256"
,
value=
32
>
<button
onclick=
"submit_query()"
>
Submit
</button>
<div
id=
"the-count"
>
<span
id=
"current"
>
0
</span>
<span
id=
"maximum"
>
/ 1000
</span>
</div>
<textarea
name=
"response"
id=
"response"
maxlength=
"2048"
placeholder=
"Megatron response..."
></textarea>
</div>
<script
type=
"text/javascript"
src=
"https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"
></script>
<script
type=
"text/javascript"
>
function
submit_query
()
{
$
(
"
#response
"
).
val
(
"
Waiting for Megatron response...
"
);
$
.
ajax
({
url
:
"
api
"
,
type
:
"
PUT
"
,
data
:
JSON
.
stringify
({
prompts
:
[
$
(
"
#prompt
"
).
val
()],
tokens_to_generate
:
parseInt
(
$
(
"
#tokens_to_generate
"
).
val
(),
10
)}),
contentType
:
"
application/json; charset=utf-8
"
,
dataType
:
"
json
"
,
success
:
function
(
data
){
data
.
max_len
=
35
;
$
(
"
#response
"
).
val
(
data
.
text
);
}
});
}
$
(
'
textarea
'
).
keyup
(
function
()
{
var
characterCount
=
$
(
this
).
val
().
length
,
current
=
$
(
'
#current
'
),
maximum
=
$
(
'
#maximum
'
),
theCount
=
$
(
'
#the-count
'
);
current
.
text
(
characterCount
);
if
(
characterCount
>=
800
)
{
maximum
.
css
(
'
color
'
,
'
#8f0001
'
);
current
.
css
(
'
color
'
,
'
#8f0001
'
);
theCount
.
css
(
'
font-weight
'
,
'
bold
'
);
}
else
{
maximum
.
css
(
'
color
'
,
'
#666
'
);
theCount
.
css
(
'
font-weight
'
,
'
normal
'
);
}
});
</script>
</body>
</html>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment