Update app.py
Browse files
app.py
CHANGED
@@ -113,7 +113,7 @@ def predict(system_msg, inputs, top_p, temperature, chat_counter, chatbot=[], hi
|
|
113 |
def reset_textbox():
|
114 |
return gr.update(value='')
|
115 |
|
116 |
-
# CSS: Buton
|
117 |
demo_css = """
|
118 |
#send_button {
|
119 |
background-color: #0b93f6;
|
@@ -128,11 +128,13 @@ demo_css = """
|
|
128 |
justify-content: center;
|
129 |
cursor: pointer;
|
130 |
transition: background-color 0.3s;
|
|
|
131 |
}
|
132 |
#send_button:hover {
|
133 |
background-color: #0077c0;
|
134 |
}
|
135 |
-
|
|
|
136 |
.compact_row {
|
137 |
gap: 0px !important;
|
138 |
margin: 0px;
|
@@ -155,14 +157,13 @@ with gr.Blocks(css=demo_css, theme=theme) as demo:
|
|
155 |
|
156 |
chatbot = gr.Chatbot(label='Trek Asistanı', elem_id="chatbot")
|
157 |
|
158 |
-
#
|
159 |
with gr.Row(elem_classes="compact_row"):
|
160 |
inputs = gr.Textbox(
|
161 |
-
placeholder="Buraya yazın, yanıtlayalım.",
|
162 |
show_label=False,
|
163 |
container=True
|
164 |
)
|
165 |
-
# Buton içeriğinde doğrudan Unicode "✈" karakterini kullanıyoruz.
|
166 |
send_button = gr.Button(value="⇨", elem_id="send_button")
|
167 |
|
168 |
state = gr.State([])
|
@@ -175,7 +176,7 @@ with gr.Blocks(css=demo_css, theme=theme) as demo:
|
|
175 |
|
176 |
# ENTER tuşu ile gönderme işlemleri.
|
177 |
inputs.submit(
|
178 |
-
predict,
|
179 |
[system_msg, inputs, top_p, temperature, chat_counter, chatbot, state],
|
180 |
[chatbot, state, chat_counter]
|
181 |
)
|
@@ -183,7 +184,7 @@ with gr.Blocks(css=demo_css, theme=theme) as demo:
|
|
183 |
|
184 |
# Gönder butonuna tıklandığında aynı işlemlerin gerçekleşmesini sağlıyoruz.
|
185 |
send_button.click(
|
186 |
-
predict,
|
187 |
[system_msg, inputs, top_p, temperature, chat_counter, chatbot, state],
|
188 |
[chatbot, state, chat_counter]
|
189 |
)
|
|
|
113 |
def reset_textbox():
|
114 |
return gr.update(value='')
|
115 |
|
116 |
+
# CSS: Buton stilini belirliyoruz ve genişlemesini önlemek için flex özelliği ekliyoruz.
|
117 |
demo_css = """
|
118 |
#send_button {
|
119 |
background-color: #0b93f6;
|
|
|
128 |
justify-content: center;
|
129 |
cursor: pointer;
|
130 |
transition: background-color 0.3s;
|
131 |
+
flex: 0 0 auto; /* Butonun sabit genişlikte kalmasını sağlar */
|
132 |
}
|
133 |
#send_button:hover {
|
134 |
background-color: #0077c0;
|
135 |
}
|
136 |
+
|
137 |
+
/* Row içindeki boşluğu sıfırlıyoruz */
|
138 |
.compact_row {
|
139 |
gap: 0px !important;
|
140 |
margin: 0px;
|
|
|
157 |
|
158 |
chatbot = gr.Chatbot(label='Trek Asistanı', elem_id="chatbot")
|
159 |
|
160 |
+
# compact_row sınıfı sayesinde metin kutusu ve buton arasındaki boşluk sıfırlanır.
|
161 |
with gr.Row(elem_classes="compact_row"):
|
162 |
inputs = gr.Textbox(
|
163 |
+
placeholder="Buraya yazın, yanıtlayalım.",
|
164 |
show_label=False,
|
165 |
container=True
|
166 |
)
|
|
|
167 |
send_button = gr.Button(value="⇨", elem_id="send_button")
|
168 |
|
169 |
state = gr.State([])
|
|
|
176 |
|
177 |
# ENTER tuşu ile gönderme işlemleri.
|
178 |
inputs.submit(
|
179 |
+
predict,
|
180 |
[system_msg, inputs, top_p, temperature, chat_counter, chatbot, state],
|
181 |
[chatbot, state, chat_counter]
|
182 |
)
|
|
|
184 |
|
185 |
# Gönder butonuna tıklandığında aynı işlemlerin gerçekleşmesini sağlıyoruz.
|
186 |
send_button.click(
|
187 |
+
predict,
|
188 |
[system_msg, inputs, top_p, temperature, chat_counter, chatbot, state],
|
189 |
[chatbot, state, chat_counter]
|
190 |
)
|