Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,7 +10,7 @@ def generate_text(prompt):
|
|
10 |
input_ids = tokenizer.encode(prompt, return_tensors="pt")
|
11 |
attention_mask = torch.ones(input_ids.shape, dtype=torch.bool)
|
12 |
|
13 |
-
max_length = model.config.n_positions if len(input_ids[0]) > model.config.n_positions else len(input_ids[0]) +
|
14 |
beam_output = model.generate(
|
15 |
input_ids,
|
16 |
attention_mask=attention_mask,
|
@@ -35,40 +35,34 @@ DESCRIPTION = """\
|
|
35 |
#Löwolf GPT1 Chat
|
36 |
"""
|
37 |
css = """
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
"""
|
49 |
|
50 |
-
|
51 |
-
|
52 |
-
gr.
|
|
|
53 |
|
54 |
-
|
55 |
-
|
56 |
-
output_box = gr.Textbox(interactive=False, lines=25, placeholder="Responses will appear here...", elem_id="output-box")
|
57 |
-
input_box = gr.Textbox(lines=1, placeholder="Type a message...", elem_id="input-box")
|
58 |
-
generate_button = gr.Button("Submit")
|
59 |
-
generate_button.click(
|
60 |
-
fn=generate,
|
61 |
-
inputs=[input_box],
|
62 |
-
outputs=output_box
|
63 |
-
)
|
64 |
-
|
65 |
-
if __name__ == "__main__":
|
66 |
-
demo.queue(max_size=20).launch()
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
|
|
|
72 |
|
73 |
|
74 |
|
|
|
10 |
input_ids = tokenizer.encode(prompt, return_tensors="pt")
|
11 |
attention_mask = torch.ones(input_ids.shape, dtype=torch.bool)
|
12 |
|
13 |
+
max_length = model.config.n_positions if len(input_ids[0]) > model.config.n_positions else len(input_ids[0]) + 20
|
14 |
beam_output = model.generate(
|
15 |
input_ids,
|
16 |
attention_mask=attention_mask,
|
|
|
35 |
#Löwolf GPT1 Chat
|
36 |
"""
|
37 |
css = """
|
38 |
+
h1 {
|
39 |
+
text-align: center;
|
40 |
+
}
|
41 |
+
|
42 |
+
#duplicate-button {
|
43 |
+
margin: auto;
|
44 |
+
color: white;
|
45 |
+
background: #1565c0;
|
46 |
+
border-radius: 100vh;
|
47 |
+
}
|
48 |
+
|
49 |
+
.contain {
|
50 |
+
max-width: 900px;
|
51 |
+
margin: auto;
|
52 |
+
padding-top: 1.5rem;
|
53 |
+
}
|
54 |
+
|
55 |
"""
|
56 |
|
57 |
+
iface = gr.Interface(
|
58 |
+
fn=generate_text,
|
59 |
+
inputs=gr.Textbox(lines=2, placeholder="Type a message...", label="Your Message"),
|
60 |
+
outputs=gr.Textbox(label="Löwolf Chat Responses", placeholder="Responses will appear here...", interactive=False, lines=10),
|
61 |
|
62 |
+
css=css
|
63 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
+
iface.launch()
|
66 |
|
67 |
|
68 |
|