Spaces:
Sleeping
Sleeping
import gradio as gr | |
import pandas as pd | |
from chatbot.bot import QuestionAnsweringBot | |
import os | |
current_dir = os.path.dirname(os.path.abspath(__file__)) | |
data_path = os.path.join(current_dir, 'data', 'chunked_data_corpus.csv') | |
chunked_data_corpus_df = pd.read_csv(data_path) | |
bot = QuestionAnsweringBot(chunked_data_corpus_df) | |
def message_respond(message, history): | |
answer = bot.form_response(message) | |
return answer | |
gr.ChatInterface( | |
fn=message_respond, | |
type="messages", | |
title="RAG System for 'The Count of Monte Cristo' book", | |
description=''' | |
This project is aimed at developing RAG system for documents corpus. | |
To be more precise, this system operates with the english version of the book 'The Count of Monte Cristo'. | |
API key for model requests is already provided. | |
Short description: | |
1. Core LLM: 'groq/llama3-8b-8192' | |
2. Cross-encoder: 'cross-encoder/ms-marco-MiniLM-L-12-v2' | |
3. Retriever: bm25 + bi-encoder('all-MiniLM-L6-v2') | |
The examples of the questions are provided below. Also, feel free to ask your own questions. | |
Full code can be found on github via this link https://github.com/rDrayBen/Neural_networks_RAG | |
''', | |
theme=gr.themes.Monochrome(font='Lora', text_size='lg', radius_size='sm'), | |
examples=["Who is Monte Cristo?", | |
"What is the title of Chapter 93", | |
"Why Edmond Dantes was in prison?", | |
"How many years does Edmon Dantes spent in prison?", | |
"Who said this sentence to whom 'Wait and hope_ (Fac et spera)'?", | |
"What is the title of Chapter 64?", | |
"Who is the president of the USA?", | |
"Who is the author of the book The Count of Monte Cristo?", | |
"Tell me about all the main identites in Monte Cristo?" | |
], | |
cache_examples=False, | |
).launch() |