RabotiahovDmytro commited on
Commit
a0d2fd3
·
verified ·
1 Parent(s): 48e3711

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -30
app.py CHANGED
@@ -1,31 +1,31 @@
1
- import gradio as gr
2
- import pandas as pd
3
- from chatbot.bot import QuestionAnsweringBot
4
- import os
5
-
6
- chunked_data_corpus_df = pd.read_csv(os.path.join(os.path.dirname(os.path.realpath(__file__)), "data\\chunked_data_corpus.csv"))
7
-
8
- bot = QuestionAnsweringBot(chunked_data_corpus_df)
9
-
10
- def message_respond(message, history):
11
- answer = bot.form_response(message)
12
- return answer
13
-
14
- gr.ChatInterface(
15
- fn=message_respond,
16
- type="messages",
17
- title="RAG System for 'The Count of Monte Cristo' book",
18
- description="Here you can ask any questions in the context of the book 'The Count of Monte Cristo'. API key is already provided.",
19
- theme=gr.themes.Monochrome(font='Lora', text_size='lg', radius_size='sm'),
20
- examples=["Who is Monte Cristo?",
21
- "What is the title of Chapter 93",
22
- "Why Edmond Dantes was in prison?",
23
- "How many years does Edmon Dantes spent in prison?",
24
- "Who said this sentence to whom 'Wait and hope_ (Fac et spera)'?",
25
- "What is the title of Chapter 64?",
26
- "Who is the president of the USA?",
27
- "Who is the author of the book The Count of Monte Cristo?",
28
- "Tell me about all the main identites in Monte Cristo?"
29
- ],
30
- cache_examples=False,
31
  ).launch()
 
1
+ import gradio as gr
2
+ import pandas as pd
3
+ from chatbot.bot import QuestionAnsweringBot
4
+ import os
5
+
6
+ chunked_data_corpus_df = pd.read_csv("../data/chunked_data_corpus.csv"))
7
+
8
+ bot = QuestionAnsweringBot(chunked_data_corpus_df)
9
+
10
+ def message_respond(message, history):
11
+ answer = bot.form_response(message)
12
+ return answer
13
+
14
+ gr.ChatInterface(
15
+ fn=message_respond,
16
+ type="messages",
17
+ title="RAG System for 'The Count of Monte Cristo' book",
18
+ description="Here you can ask any questions in the context of the book 'The Count of Monte Cristo'. API key is already provided.",
19
+ theme=gr.themes.Monochrome(font='Lora', text_size='lg', radius_size='sm'),
20
+ examples=["Who is Monte Cristo?",
21
+ "What is the title of Chapter 93",
22
+ "Why Edmond Dantes was in prison?",
23
+ "How many years does Edmon Dantes spent in prison?",
24
+ "Who said this sentence to whom 'Wait and hope_ (Fac et spera)'?",
25
+ "What is the title of Chapter 64?",
26
+ "Who is the president of the USA?",
27
+ "Who is the author of the book The Count of Monte Cristo?",
28
+ "Tell me about all the main identites in Monte Cristo?"
29
+ ],
30
+ cache_examples=False,
31
  ).launch()