|
import os |
|
import gradio as gr |
|
from rag_system import RAGSystem |
|
|
|
|
|
rag = RAGSystem( |
|
vector_db_path="vector_db", |
|
model_name="meta-llama/Llama-3-8b-chat-hf", |
|
embedding_model_name="sentence-transformers/all-mpnet-base-v2" |
|
) |
|
|
|
rag.load_vectorstore() |
|
rag.load_llm() |
|
rag.get_prompt_template() |
|
|
|
|
|
def ask_question_interface(question): |
|
return rag.ask_question(question) |
|
|
|
|
|
demo = gr.Interface( |
|
fn=ask_question_interface, |
|
inputs=gr.Textbox(label="Ask a question about the ECC Guide"), |
|
outputs=gr.Textbox(label="Answer"), |
|
title="ECC Cybersecurity Assistant", |
|
description="Ask questions based on the Essential Cybersecurity Controls (ECC) Implementation Guide issued by the NCA (Saudi Arabia).", |
|
) |
|
|
|
if __name__ == "__main__": |
|
demo.launch() |
|
|