Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -58,13 +58,13 @@ def clear_history(history):
|
|
| 58 |
|
| 59 |
def main():
|
| 60 |
vectorstore = get_chroma_vectorstore(get_SFR_Code_embedding_model(), vectorstore_path)
|
| 61 |
-
llm = get_groq_llm(
|
| 62 |
|
| 63 |
kadi_bot = KadiBot(llm, vectorstore)
|
| 64 |
|
| 65 |
with gr.Blocks() as demo:
|
| 66 |
gr.Markdown("## KadiAPY - AI Coding-Assistant")
|
| 67 |
-
gr.Markdown("AI Coding-
|
| 68 |
|
| 69 |
# Create a state for session management
|
| 70 |
chat_history = gr.State([])
|
|
@@ -79,7 +79,9 @@ def main():
|
|
| 79 |
with gr.Column(scale=1):
|
| 80 |
submit_btn = gr.Button("Submit", variant="primary")
|
| 81 |
with gr.Column(scale=1):
|
| 82 |
-
|
|
|
|
|
|
|
| 83 |
|
| 84 |
gr.Examples(
|
| 85 |
examples=[
|
|
@@ -99,7 +101,10 @@ def main():
|
|
| 99 |
.then(kadi_bot.handle_chat, [chat_history], [chatbot])
|
| 100 |
submit_btn.click(add_text_to_chat_history, [chat_history, user_txt], [chat_history, user_txt]).then(show_history, [chat_history], [chatbot])\
|
| 101 |
.then(kadi_bot.handle_chat, [chat_history], [chatbot])
|
| 102 |
-
|
|
|
|
|
|
|
|
|
|
| 103 |
demo.launch()
|
| 104 |
|
| 105 |
|
|
|
|
| 58 |
|
| 59 |
def main():
|
| 60 |
vectorstore = get_chroma_vectorstore(get_SFR_Code_embedding_model(), vectorstore_path)
|
| 61 |
+
llm = get_groq_llm("qwen-2.5-coder-32b", "0.0", GROQ_API_KEY)
|
| 62 |
|
| 63 |
kadi_bot = KadiBot(llm, vectorstore)
|
| 64 |
|
| 65 |
with gr.Blocks() as demo:
|
| 66 |
gr.Markdown("## KadiAPY - AI Coding-Assistant")
|
| 67 |
+
gr.Markdown("AI Coding-Assistnat for KadiAPY based on RAG architecture powered by LLM")
|
| 68 |
|
| 69 |
# Create a state for session management
|
| 70 |
chat_history = gr.State([])
|
|
|
|
| 79 |
with gr.Column(scale=1):
|
| 80 |
submit_btn = gr.Button("Submit", variant="primary")
|
| 81 |
with gr.Column(scale=1):
|
| 82 |
+
clear_input_btn = gr.Button("Clear Input", variant="stop")
|
| 83 |
+
with gr.Column(scale=1):
|
| 84 |
+
clear_chat_btn = gr.Button("Clear Chat", variant="stop") # New button to clear chat history
|
| 85 |
|
| 86 |
gr.Examples(
|
| 87 |
examples=[
|
|
|
|
| 101 |
.then(kadi_bot.handle_chat, [chat_history], [chatbot])
|
| 102 |
submit_btn.click(add_text_to_chat_history, [chat_history, user_txt], [chat_history, user_txt]).then(show_history, [chat_history], [chatbot])\
|
| 103 |
.then(kadi_bot.handle_chat, [chat_history], [chatbot])
|
| 104 |
+
clear_input_btn.click(lambda: ("",), [], [user_txt])
|
| 105 |
+
clear_chat_btn.click(lambda: ([], ""), [], [chat_history, chatbot])
|
| 106 |
+
|
| 107 |
+
|
| 108 |
demo.launch()
|
| 109 |
|
| 110 |
|