Spaces:
Runtime error
Runtime error
vericudebuget
commited on
Commit
•
29dc230
1
Parent(s):
d3c268a
Update app.py
Browse files
app.py
CHANGED
@@ -45,48 +45,17 @@ additional_inputs = [
|
|
45 |
gr.Slider(label="Repetition penalty", value=1.2, minimum=1.0, maximum=2.0, step=0.05, interactive=True, info="Penalize repeated tokens")
|
46 |
]
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
.gr-button, .gr-text-input, .gr-chatbot {
|
54 |
-
border-radius: 15px;
|
55 |
-
}
|
56 |
-
.gr-button {
|
57 |
-
width: 48px;
|
58 |
-
height: 48px;
|
59 |
-
background-color: #673ab7;
|
60 |
-
color: #fff;
|
61 |
-
font-size: 24px;
|
62 |
-
display: flex;
|
63 |
-
justify-content: center;
|
64 |
-
align-items: center;
|
65 |
-
}
|
66 |
-
#row {
|
67 |
-
display: flex;
|
68 |
-
align-items: center;
|
69 |
-
}
|
70 |
-
#text-input {
|
71 |
-
flex-grow: 1;
|
72 |
-
}
|
73 |
-
""") as app:
|
74 |
-
with gr.Row(elem_id="row"):
|
75 |
-
text_input = gr.Textbox(label="Your message", placeholder="Type your message...", lines=1, max_lines=1, elem_id="text-input")
|
76 |
-
submit_btn = gr.Button(
|
77 |
-
"send",
|
78 |
-
variant="primary",
|
79 |
-
css_classes="material-symbols-outlined rounded-btn"
|
80 |
-
).style(square=True)
|
81 |
-
|
82 |
-
chatbot = gr.Chatbot().style(height="calc(100vh - 100px)")
|
83 |
|
84 |
def process_message(message, history):
|
85 |
response = generate(message, history, additional_inputs[0].value)
|
86 |
history.extend(response)
|
87 |
return history, ""
|
88 |
|
89 |
-
text_input.submit(process_message, inputs=[text_input, chatbot], outputs=[chatbot, text_input])
|
90 |
submit_btn.click(process_message, inputs=[text_input, chatbot], outputs=[chatbot, text_input])
|
91 |
|
92 |
app.launch(show_api=False)
|
|
|
45 |
gr.Slider(label="Repetition penalty", value=1.2, minimum=1.0, maximum=2.0, step=0.05, interactive=True, info="Penalize repeated tokens")
|
46 |
]
|
47 |
|
48 |
+
app = gr.Blocks(theme=gr.themes.Soft())
|
49 |
+
with app:
|
50 |
+
chatbot = gr.Chatbot()
|
51 |
+
text_input = gr.Textbox(label="Your message")
|
52 |
+
submit_btn = gr.Button("Submit")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
|
54 |
def process_message(message, history):
|
55 |
response = generate(message, history, additional_inputs[0].value)
|
56 |
history.extend(response)
|
57 |
return history, ""
|
58 |
|
|
|
59 |
submit_btn.click(process_message, inputs=[text_input, chatbot], outputs=[chatbot, text_input])
|
60 |
|
61 |
app.launch(show_api=False)
|