Upload app.py
Browse files
app.py
CHANGED
|
@@ -113,91 +113,26 @@ qa_chain = RetrievalQA.from_chain_type(
|
|
| 113 |
)
|
| 114 |
|
| 115 |
# Gradio UI düzeni
|
| 116 |
-
with gr.Blocks(
|
| 117 |
-
body {
|
| 118 |
-
background-color: #121212;
|
| 119 |
-
color: #ffffff;
|
| 120 |
-
font-family: 'Segoe UI', sans-serif;
|
| 121 |
-
}
|
| 122 |
-
|
| 123 |
-
h1 {
|
| 124 |
-
color: #ffffff;
|
| 125 |
-
text-align: center;
|
| 126 |
-
margin-bottom: 20px;
|
| 127 |
-
}
|
| 128 |
-
|
| 129 |
-
.gr-button {
|
| 130 |
-
font-weight: bold;
|
| 131 |
-
border-radius: 10px;
|
| 132 |
-
}
|
| 133 |
-
|
| 134 |
-
.gr-button.primary {
|
| 135 |
-
background: linear-gradient(to right, #4facfe, #00f2fe);
|
| 136 |
-
color: white;
|
| 137 |
-
}
|
| 138 |
-
|
| 139 |
-
.gr-button:hover {
|
| 140 |
-
opacity: 0.9;
|
| 141 |
-
}
|
| 142 |
-
|
| 143 |
-
/* Sohbet kutusu stilleri (HTML içinde uygulanırsa çalışır) */
|
| 144 |
-
.gr-html div.chat-bubble {
|
| 145 |
-
padding: 12px;
|
| 146 |
-
border-radius: 12px;
|
| 147 |
-
margin-bottom: 10px;
|
| 148 |
-
font-size: 16px;
|
| 149 |
-
color: #ffffff;
|
| 150 |
-
}
|
| 151 |
-
|
| 152 |
-
.gr-html div.chat-question {
|
| 153 |
-
background-color: #1e2a38;
|
| 154 |
-
border-left: 4px solid #3498db;
|
| 155 |
-
}
|
| 156 |
-
|
| 157 |
-
.gr-html div.chat-answer {
|
| 158 |
-
background-color: #1d352a;
|
| 159 |
-
border-left: 4px solid #2ecc71;
|
| 160 |
-
}
|
| 161 |
-
|
| 162 |
-
/* Textarea (soru giriş kutusu) görünümü */
|
| 163 |
-
textarea {
|
| 164 |
-
background-color: #1e1e1e !important;
|
| 165 |
-
color: #ffffff !important;
|
| 166 |
-
border-radius: 14px !important;
|
| 167 |
-
font-size: 16px !important;
|
| 168 |
-
border: 1px solid #444 !important;
|
| 169 |
-
padding: 10px !important;
|
| 170 |
-
}
|
| 171 |
-
|
| 172 |
-
.gr-number input {
|
| 173 |
-
background-color: #1e1e1e !important;
|
| 174 |
-
color: #ffffff !important;
|
| 175 |
-
border-radius: 8px !important;
|
| 176 |
-
font-weight: bold !important;
|
| 177 |
-
border: 1px solid #444 !important;
|
| 178 |
-
}
|
| 179 |
-
|
| 180 |
-
.gr-file label, .gr-html, .gr-markdown {
|
| 181 |
-
color: #ffffff !important;
|
| 182 |
-
}
|
| 183 |
-
""") as demo:
|
| 184 |
-
|
| 185 |
-
|
| 186 |
gr.Markdown("# 📘 EğitBot - Eğitim Asistanı")
|
| 187 |
|
| 188 |
with gr.Row():
|
| 189 |
with gr.Column(scale=2):
|
| 190 |
-
|
| 191 |
-
|
|
|
|
| 192 |
|
| 193 |
-
|
|
|
|
| 194 |
|
| 195 |
-
|
|
|
|
| 196 |
|
| 197 |
with gr.Column(scale=1):
|
|
|
|
| 198 |
clear_btn = gr.Button("♻️ Geçmişi Temizle", variant="primary")
|
| 199 |
save_btn = gr.Button("💾 Sohbeti Kaydet", variant="primary")
|
| 200 |
-
download_file = gr.File(label="
|
| 201 |
|
| 202 |
# Sohbeti temizleme fonksiyonu
|
| 203 |
def clear_chat():
|
|
|
|
| 113 |
)
|
| 114 |
|
| 115 |
# Gradio UI düzeni
|
| 116 |
+
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
gr.Markdown("# 📘 EğitBot - Eğitim Asistanı")
|
| 118 |
|
| 119 |
with gr.Row():
|
| 120 |
with gr.Column(scale=2):
|
| 121 |
+
# Soru sorma alanı
|
| 122 |
+
user_input = gr.Textbox(placeholder="Sorunuzu buraya yazınız...", label="Soru")
|
| 123 |
+
send_btn = gr.Button("Gönder")
|
| 124 |
|
| 125 |
+
# Toplam soru sayısı
|
| 126 |
+
total_q = gr.Number(value=0, label="Toplam Sorulan Soru", interactive=False)
|
| 127 |
|
| 128 |
+
# Sohbet geçmişi
|
| 129 |
+
chatbox = gr.HTML(value="", label="Sohbet Geçmişi")
|
| 130 |
|
| 131 |
with gr.Column(scale=1):
|
| 132 |
+
# Sohbeti kaydetme ve temizleme butonları
|
| 133 |
clear_btn = gr.Button("♻️ Geçmişi Temizle", variant="primary")
|
| 134 |
save_btn = gr.Button("💾 Sohbeti Kaydet", variant="primary")
|
| 135 |
+
download_file = gr.File(label="İndir")
|
| 136 |
|
| 137 |
# Sohbeti temizleme fonksiyonu
|
| 138 |
def clear_chat():
|