Spaces:
Runtime error
Runtime error
default character added
Browse files
app.py
CHANGED
@@ -178,10 +178,10 @@ model.to(device)
|
|
178 |
# generate from the model
|
179 |
context = torch.zeros((1, 1), dtype=torch.long, device=device)
|
180 |
|
181 |
-
def greet(start_character=" "
|
182 |
context[0][0] = encode(start_character)[0]
|
183 |
max_new_tokens = number_of_tokens
|
184 |
return decode(model.generate(context, max_new_tokens=int(max_new_tokens))[0].tolist())
|
185 |
|
186 |
-
iface = gr.Interface(fn=greet, inputs=["
|
187 |
iface.launch()
|
|
|
178 |
# generate from the model
|
179 |
context = torch.zeros((1, 1), dtype=torch.long, device=device)
|
180 |
|
181 |
+
def greet(number_of_tokens, start_character=" "):
|
182 |
context[0][0] = encode(start_character)[0]
|
183 |
max_new_tokens = number_of_tokens
|
184 |
return decode(model.generate(context, max_new_tokens=int(max_new_tokens))[0].tolist())
|
185 |
|
186 |
+
iface = gr.Interface(fn=greet, inputs=["number", "text"], outputs="text")
|
187 |
iface.launch()
|