Spaces:
Sleeping
Sleeping
un-index
commited on
Commit
·
7216e2e
1
Parent(s):
103f0d1
app.py
CHANGED
|
@@ -74,9 +74,11 @@ headers = {"Authorization": f"Bearer {os.environ['API_TOKEN']}"}
|
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
-
def f(context, temperature, top_p, max_length, model_idx):
|
| 78 |
try:
|
| 79 |
|
|
|
|
|
|
|
| 80 |
|
| 81 |
# maybe try "0" instead or 1, or "1"
|
| 82 |
# use GPT-J-6B
|
|
@@ -148,6 +150,8 @@ iface = gr.Interface(f, [
|
|
| 148 |
gr.inputs.Slider(
|
| 149 |
minimum=20, maximum=512, default=30, label="max length"),
|
| 150 |
gr.inputs.Dropdown(["GPT-J-6B", "GPT-2"], type="index", label="model"),
|
|
|
|
|
|
|
| 151 |
], outputs="text", title=title, examples=examples)
|
| 152 |
iface.launch() # enable_queue=True
|
| 153 |
|
|
|
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
+
def f(context, temperature, top_p, max_length, model_idx, SPACE_VERIFICATION_KEY):
|
| 78 |
try:
|
| 79 |
|
| 80 |
+
if os.environ['SPACE_VERIFICATION_KEY'] != SPACE_VERIFICATION_KEY:
|
| 81 |
+
return "invalid SPACE_VERIFICATION_KEY; see project secrets to view key"
|
| 82 |
|
| 83 |
# maybe try "0" instead or 1, or "1"
|
| 84 |
# use GPT-J-6B
|
|
|
|
| 150 |
gr.inputs.Slider(
|
| 151 |
minimum=20, maximum=512, default=30, label="max length"),
|
| 152 |
gr.inputs.Dropdown(["GPT-J-6B", "GPT-2"], type="index", label="model"),
|
| 153 |
+
gr.inputs.Textbox(lines=1, placeholder="space key", default="xxxxxxxx", label="space verification key")
|
| 154 |
+
|
| 155 |
], outputs="text", title=title, examples=examples)
|
| 156 |
iface.launch() # enable_queue=True
|
| 157 |
|