Spaces:
Sleeping
Sleeping
un-index
commited on
Commit
·
68394f9
1
Parent(s):
bba0271
app.py
CHANGED
|
@@ -21,10 +21,21 @@ import gradio as gr
|
|
| 21 |
# ex = e
|
| 22 |
|
| 23 |
temperature = gr.inputs.Slider(
|
| 24 |
-
minimum=0, maximum=1.5, default=0.
|
| 25 |
top_p = gr.inputs.Slider(minimum=0, maximum=1.0,
|
| 26 |
default=0.9, label="top_p")
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
def f(text, temperature, top_p):
|
| 30 |
try:
|
|
@@ -48,19 +59,12 @@ def f(text, temperature, top_p):
|
|
| 48 |
iface = gr.Interface(f, [
|
| 49 |
"text",
|
| 50 |
temperature,
|
| 51 |
-
top_p], outputs="text")
|
| 52 |
iface.launch() # enable_queue=True
|
| 53 |
|
| 54 |
# all below works but testing
|
| 55 |
# import gradio as gr
|
| 56 |
|
| 57 |
-
# title = "GPT-J-6B"
|
| 58 |
-
|
| 59 |
-
# examples = [
|
| 60 |
-
# ['The tower is 324 metres (1,063 ft) tall,'],
|
| 61 |
-
# ["The Moon's orbit around Earth has"],
|
| 62 |
-
# ["The smooth Borealis basin in the Northern Hemisphere covers 40%"]
|
| 63 |
-
# ]
|
| 64 |
|
| 65 |
# gr.Interface.load("huggingface/EleutherAI/gpt-j-6B",
|
| 66 |
# inputs=gr.inputs.Textbox(lines=10, label="Input Text"),
|
|
|
|
| 21 |
# ex = e
|
| 22 |
|
| 23 |
temperature = gr.inputs.Slider(
|
| 24 |
+
minimum=0, maximum=1.5, default=0.8, label="temperature")
|
| 25 |
top_p = gr.inputs.Slider(minimum=0, maximum=1.0,
|
| 26 |
default=0.9, label="top_p")
|
| 27 |
|
| 28 |
+
# gradio checkbutton
|
| 29 |
+
|
| 30 |
+
|
| 31 |
+
title = "GPT-J-6B"
|
| 32 |
+
|
| 33 |
+
examples = [
|
| 34 |
+
# another machine learning example
|
| 35 |
+
["For today's homework assignment, please describe the reasons for the US Civil War."],
|
| 36 |
+
["In a shocking discovery, scientists have found a herd of unicorns living in a remote, previously unexplored valley, in the Andes Mountains. Even more surprising to the researchers was the fact that the unicorns spoke perfect English."],
|
| 37 |
+
["The first step in the process of developing a new language is to invent a new word."],
|
| 38 |
+
]
|
| 39 |
|
| 40 |
def f(text, temperature, top_p):
|
| 41 |
try:
|
|
|
|
| 59 |
iface = gr.Interface(f, [
|
| 60 |
"text",
|
| 61 |
temperature,
|
| 62 |
+
top_p], outputs="text", title=title, examples=examples)
|
| 63 |
iface.launch() # enable_queue=True
|
| 64 |
|
| 65 |
# all below works but testing
|
| 66 |
# import gradio as gr
|
| 67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 68 |
|
| 69 |
# gr.Interface.load("huggingface/EleutherAI/gpt-j-6B",
|
| 70 |
# inputs=gr.inputs.Textbox(lines=10, label="Input Text"),
|