Spaces:
Runtime error
Runtime error
MarcoAland
commited on
Commit
•
114679c
1
Parent(s):
934c4c9
update app
Browse files- RAGModule.py +0 -3
- __pycache__/RAGModule.cpython-310.pyc +0 -0
- app.py +8 -7
RAGModule.py
CHANGED
@@ -25,9 +25,6 @@ class RAGModule:
|
|
25 |
# Define embedding model
|
26 |
set_embed_model(model_name=embedding_model)
|
27 |
|
28 |
-
# Define llm model in Settings module
|
29 |
-
# self.llm_model = set_llm_model(model_name=llm_model)
|
30 |
-
|
31 |
# Set vector DB
|
32 |
documents = SimpleDirectoryReader(docs_path).load_data()
|
33 |
index = VectorStoreIndex.from_documents(documents)
|
|
|
25 |
# Define embedding model
|
26 |
set_embed_model(model_name=embedding_model)
|
27 |
|
|
|
|
|
|
|
28 |
# Set vector DB
|
29 |
documents = SimpleDirectoryReader(docs_path).load_data()
|
30 |
index = VectorStoreIndex.from_documents(documents)
|
__pycache__/RAGModule.cpython-310.pyc
ADDED
Binary file (2.59 kB). View file
|
|
app.py
CHANGED
@@ -16,11 +16,12 @@ settings = {
|
|
16 |
}
|
17 |
|
18 |
async def generate_response(user_input: str) -> str:
|
|
|
19 |
# Call documents options or not
|
20 |
-
if "document:" in
|
21 |
-
prompt = RAG_Trwira.main(
|
22 |
else:
|
23 |
-
prompt =
|
24 |
|
25 |
# Format the messages as a list of message dictionaries
|
26 |
message_formated = [
|
@@ -45,12 +46,12 @@ def chat(user_input: str):
|
|
45 |
# Define the Gradio interface
|
46 |
iface = gr.Interface(
|
47 |
fn=chat,
|
48 |
-
inputs=gr.Textbox(label="Masukkan pertanyaan anda", placeholder="
|
49 |
-
outputs=gr.Textbox(label="
|
50 |
title="Hai, namaku Mitrakara. Selamat datang!👋",
|
51 |
-
description="
|
52 |
)
|
53 |
|
54 |
# Launch the Gradio interface
|
55 |
if __name__ == "__main__":
|
56 |
-
iface.launch()
|
|
|
16 |
}
|
17 |
|
18 |
async def generate_response(user_input: str) -> str:
|
19 |
+
message = "Namamu adalah Mitrakara dan setiap respon harus diakhiri dengan kata '-Mitrakara' , kecuali pertanyaan mengenai namamu.\n\n" + user_input
|
20 |
# Call documents options or not
|
21 |
+
if "dokumen:" in message.lower() or "document:" in message.lower() or "documents:" in message.lower():
|
22 |
+
prompt = RAG_Trwira.main(message[10:])
|
23 |
else:
|
24 |
+
prompt = message
|
25 |
|
26 |
# Format the messages as a list of message dictionaries
|
27 |
message_formated = [
|
|
|
46 |
# Define the Gradio interface
|
47 |
iface = gr.Interface(
|
48 |
fn=chat,
|
49 |
+
inputs=gr.Textbox(label="Masukkan pertanyaan anda", placeholder="Tanyakan saja padaku🌟"),
|
50 |
+
outputs=gr.Textbox(label="Respons Mitrakara"),
|
51 |
title="Hai, namaku Mitrakara. Selamat datang!👋",
|
52 |
+
description="Berikut adalah beberapa tips untuk bertanya denganku✨✨✨\n1. Gunakan kata 'document:' jika ingin bertanya mengenai perusahaan.\n2. Gunakan kalimat tanya yang baik.\n3. Enjoy the conversation😊"
|
53 |
)
|
54 |
|
55 |
# Launch the Gradio interface
|
56 |
if __name__ == "__main__":
|
57 |
+
iface.launch(share=False)
|