Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from ragatouille import RAGPretrainedModel
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
-
|
5 |
|
6 |
path_to_index = 'colbert/indexes/ArColbertQuran'
|
7 |
message = "waiting to load index ..."
|
@@ -21,13 +21,13 @@ def process_results(results):
|
|
21 |
k = 3 # How many documents you want to retrieve
|
22 |
|
23 |
def answer_fn(query):
|
24 |
-
results = RAG.search(query= query, k=k)
|
25 |
return process_results(results)
|
26 |
|
27 |
qapp = gr.Interface(fn=answer_fn, inputs="textbox", outputs="textbox",
|
28 |
examples=[
|
29 |
"ما أهمية كتابة المعاملات؟", "أخبرني عن عذاب الله للمنافقين", "حسن معاملة الوالدين", "ما معجزات سيدنا عيسى", "ما هو التطفيف"
|
30 |
-
,"ما قصة المؤمنين الذين قتلوا في الحفرة؟"],
|
31 |
title="Qur\'an Retrieval Demo - Semantic Search",
|
32 |
description="A basic demo based on Arabic ColBERT (100k triplets) and simple text of the Qur\'an. First query may take a minute, then much faster.\
|
33 |
Try to include relevant terms - this is just retrieval, not LLM chat and Qur\'an is an edge case.\
|
|
|
1 |
from ragatouille import RAGPretrainedModel
|
2 |
import os
|
3 |
import gradio as gr
|
4 |
+
from unicodedata import normalize
|
5 |
|
6 |
path_to_index = 'colbert/indexes/ArColbertQuran'
|
7 |
message = "waiting to load index ..."
|
|
|
21 |
k = 3 # How many documents you want to retrieve
|
22 |
|
23 |
def answer_fn(query):
|
24 |
+
results = RAG.search(query= normalize('NFKC', query), k=k)
|
25 |
return process_results(results)
|
26 |
|
27 |
qapp = gr.Interface(fn=answer_fn, inputs="textbox", outputs="textbox",
|
28 |
examples=[
|
29 |
"ما أهمية كتابة المعاملات؟", "أخبرني عن عذاب الله للمنافقين", "حسن معاملة الوالدين", "ما معجزات سيدنا عيسى", "ما هو التطفيف"
|
30 |
+
,"ما قصة المؤمنين الذين قتلوا في الحفرة؟", "ما آداب اﻻستئذان؟", "النبي الذي تربى في بيت حاكم مصر"],
|
31 |
title="Qur\'an Retrieval Demo - Semantic Search",
|
32 |
description="A basic demo based on Arabic ColBERT (100k triplets) and simple text of the Qur\'an. First query may take a minute, then much faster.\
|
33 |
Try to include relevant terms - this is just retrieval, not LLM chat and Qur\'an is an edge case.\
|