Update app.py
Browse files
app.py
CHANGED
@@ -104,22 +104,22 @@ def predict(system_msg, inputs, top_p, temperature, chat_counter, chatbot=[], hi
|
|
104 |
def reset_textbox():
|
105 |
return gr.update(value='')
|
106 |
|
107 |
-
# CSS
|
108 |
demo_css = """
|
109 |
-
/*
|
110 |
.compact_row {
|
111 |
display: flex !important;
|
112 |
flex-wrap: nowrap !important;
|
113 |
align-items: center !important;
|
114 |
-
|
115 |
-
|
|
|
116 |
}
|
117 |
|
118 |
-
/* Giriş
|
119 |
.mobile_input {
|
120 |
-
/* Buton alanı sabit 45px olacak şekilde, kalan alanı kullan */
|
121 |
width: calc(100% - 45px) !important;
|
122 |
-
min-width: 0;
|
123 |
}
|
124 |
|
125 |
/* Gönder butonu */
|
@@ -145,15 +145,15 @@ demo_css = """
|
|
145 |
background-color: #0077c0;
|
146 |
}
|
147 |
|
148 |
-
/* Buton kapsayıcısı:
|
149 |
.fixed_button_container {
|
150 |
width: 35px !important;
|
151 |
-
padding:
|
152 |
margin: 5px 0 0 2px; /* Üstte 5px, solda 2px boşluk */
|
153 |
}
|
154 |
"""
|
155 |
|
156 |
-
# Tema
|
157 |
theme = gr.themes.Base(
|
158 |
neutral_hue="blue",
|
159 |
text_size="sm",
|
@@ -169,7 +169,7 @@ with gr.Blocks(css=demo_css, theme=theme) as demo:
|
|
169 |
|
170 |
chatbot = gr.Chatbot(label='Trek Asistanı', elem_id="chatbot")
|
171 |
|
172 |
-
#
|
173 |
with gr.Row(elem_classes="compact_row"):
|
174 |
inputs = gr.Textbox(
|
175 |
placeholder="Buraya yazın, yanıtlayalım.",
|
@@ -188,7 +188,7 @@ with gr.Blocks(css=demo_css, theme=theme) as demo:
|
|
188 |
step=0.1, interactive=False, visible=False)
|
189 |
chat_counter = gr.Number(value=0, visible=False, precision=0)
|
190 |
|
191 |
-
# ENTER tuşuyla gönderme
|
192 |
inputs.submit(
|
193 |
predict,
|
194 |
[system_msg, inputs, top_p, temperature, chat_counter, chatbot, state],
|
@@ -196,7 +196,6 @@ with gr.Blocks(css=demo_css, theme=theme) as demo:
|
|
196 |
)
|
197 |
inputs.submit(reset_textbox, [], [inputs])
|
198 |
|
199 |
-
# Gönder butonuna tıklanıldığında
|
200 |
send_button.click(
|
201 |
predict,
|
202 |
[system_msg, inputs, top_p, temperature, chat_counter, chatbot, state],
|
|
|
104 |
def reset_textbox():
|
105 |
return gr.update(value='')
|
106 |
|
107 |
+
# CSS ayarları:
|
108 |
demo_css = """
|
109 |
+
/* Satırın tamamını kaplayan flex container */
|
110 |
.compact_row {
|
111 |
display: flex !important;
|
112 |
flex-wrap: nowrap !important;
|
113 |
align-items: center !important;
|
114 |
+
width: 100% !important;
|
115 |
+
gap: 0 !important;
|
116 |
+
margin: 0;
|
117 |
}
|
118 |
|
119 |
+
/* Giriş kutusu: buton alanı kadar çıkarmak için */
|
120 |
.mobile_input {
|
|
|
121 |
width: calc(100% - 45px) !important;
|
122 |
+
min-width: 0;
|
123 |
}
|
124 |
|
125 |
/* Gönder butonu */
|
|
|
145 |
background-color: #0077c0;
|
146 |
}
|
147 |
|
148 |
+
/* Buton kapsayıcısı: kenar boşluklarını ayarla */
|
149 |
.fixed_button_container {
|
150 |
width: 35px !important;
|
151 |
+
padding: 0;
|
152 |
margin: 5px 0 0 2px; /* Üstte 5px, solda 2px boşluk */
|
153 |
}
|
154 |
"""
|
155 |
|
156 |
+
# Tema ayarları:
|
157 |
theme = gr.themes.Base(
|
158 |
neutral_hue="blue",
|
159 |
text_size="sm",
|
|
|
169 |
|
170 |
chatbot = gr.Chatbot(label='Trek Asistanı', elem_id="chatbot")
|
171 |
|
172 |
+
# Giriş kutusu ve buton aynı satırda, satır tüm genişliği kaplasın.
|
173 |
with gr.Row(elem_classes="compact_row"):
|
174 |
inputs = gr.Textbox(
|
175 |
placeholder="Buraya yazın, yanıtlayalım.",
|
|
|
188 |
step=0.1, interactive=False, visible=False)
|
189 |
chat_counter = gr.Number(value=0, visible=False, precision=0)
|
190 |
|
191 |
+
# ENTER tuşuyla gönderme işlemleri:
|
192 |
inputs.submit(
|
193 |
predict,
|
194 |
[system_msg, inputs, top_p, temperature, chat_counter, chatbot, state],
|
|
|
196 |
)
|
197 |
inputs.submit(reset_textbox, [], [inputs])
|
198 |
|
|
|
199 |
send_button.click(
|
200 |
predict,
|
201 |
[system_msg, inputs, top_p, temperature, chat_counter, chatbot, state],
|