Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -27,13 +27,12 @@ def respond(
|
|
27 |
temperature,
|
28 |
top_p,
|
29 |
):
|
30 |
-
messages = [{"role": "system", "content": "You are a sunni moslem bot that always give answer based on quran, hadith, and the companions of prophet Muhammad!"}]
|
31 |
#make a moslem bot
|
32 |
messages.append({"role": "user", "content": "I want you to answer strictly based on quran and hadith"})
|
33 |
messages.append({"role": "assistant", "content": "I'd be happy to help! Please go ahead and provide the sentence you'd like me to analyze. Please specify whether you're referencing a particular verse or hadith (Prophetic tradition) from the Quran or Hadith, or if you're asking me to analyze a general statement."})
|
34 |
|
35 |
#adding fatwa references
|
36 |
-
'''
|
37 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
38 |
selected_references = torch.load('selected_references.sav', map_location=torch.device(device))
|
39 |
encoded_questions = torch.load('encoded_questions.sav', map_location=torch.device(device))
|
@@ -82,7 +81,7 @@ def respond(
|
|
82 |
for index, row in df.iterrows():
|
83 |
messages.append({"role": "user", "content": row['user']})
|
84 |
messages.append({"role": "assistant", "content": row['assistant']})
|
85 |
-
|
86 |
#latest user question
|
87 |
translator = Translator()
|
88 |
en_message = ""
|
|
|
27 |
temperature,
|
28 |
top_p,
|
29 |
):
|
30 |
+
messages = [{"role": "system", "content": "You are a sunni moslem bot that always give answer based on quran, hadith, and the companions of prophet Muhammad! Do not ever give answer, that's on opposite of the teaching of Quran, Hadiths, and the companions of prophet Muhammad. Modern scholars opinion that could be taken as your baseline is 'Muhammad bin Shalih al-Utsaimin', 'Shalih bin Fauzan al-Fauzan', 'Abd al-Aziz ibn Abdullah ibn Baz', Muhammad Bin Abdul Wahab', and fatwa from 'dar al ifta' or 'https://islamonline.net/en'"}]
|
31 |
#make a moslem bot
|
32 |
messages.append({"role": "user", "content": "I want you to answer strictly based on quran and hadith"})
|
33 |
messages.append({"role": "assistant", "content": "I'd be happy to help! Please go ahead and provide the sentence you'd like me to analyze. Please specify whether you're referencing a particular verse or hadith (Prophetic tradition) from the Quran or Hadith, or if you're asking me to analyze a general statement."})
|
34 |
|
35 |
#adding fatwa references
|
|
|
36 |
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
37 |
selected_references = torch.load('selected_references.sav', map_location=torch.device(device))
|
38 |
encoded_questions = torch.load('encoded_questions.sav', map_location=torch.device(device))
|
|
|
81 |
for index, row in df.iterrows():
|
82 |
messages.append({"role": "user", "content": row['user']})
|
83 |
messages.append({"role": "assistant", "content": row['assistant']})
|
84 |
+
|
85 |
#latest user question
|
86 |
translator = Translator()
|
87 |
en_message = ""
|