Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -63,10 +63,11 @@ stoi, itos = meta['stoi'], meta['itos']
|
|
63 |
encode = lambda s: [stoi[c] for c in s]
|
64 |
decode = lambda l: ''.join([itos[i] for i in l])
|
65 |
|
66 |
-
def gen(input)
|
67 |
start_ids = encode(add_caseifer(input))
|
68 |
x = (torch.tensor(start_ids, dtype=torch.long, device=device)[None, ...])
|
69 |
y = model.generate(x, max_new_tokens, temperature=temperature, top_k=top_k)
|
70 |
return remove_caseifer(decode(y[0].tolist()))
|
|
|
71 |
iface = gr.Interface(fn=gen, inputs="text", outputs="text")
|
72 |
iface.launch()
|
|
|
63 |
encode = lambda s: [stoi[c] for c in s]
|
64 |
decode = lambda l: ''.join([itos[i] for i in l])
|
65 |
|
66 |
+
def gen(input):
|
67 |
start_ids = encode(add_caseifer(input))
|
68 |
x = (torch.tensor(start_ids, dtype=torch.long, device=device)[None, ...])
|
69 |
y = model.generate(x, max_new_tokens, temperature=temperature, top_k=top_k)
|
70 |
return remove_caseifer(decode(y[0].tolist()))
|
71 |
+
|
72 |
iface = gr.Interface(fn=gen, inputs="text", outputs="text")
|
73 |
iface.launch()
|