Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -11,10 +11,22 @@ from Gradio_UI import GradioUI
|
|
| 11 |
@tool
|
| 12 |
def get_ayyahs(word:str,required_instances:int = 3)->list:
|
| 13 |
"""
|
| 14 |
-
|
|
|
|
| 15 |
Args:
|
| 16 |
-
word:
|
| 17 |
-
required_instances:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
"""
|
| 19 |
ayats = []
|
| 20 |
url = f"http://api.alquran.cloud/v1/search/{word}/all/en.asad"
|
|
@@ -34,7 +46,7 @@ def get_ayyahs(word:str,required_instances:int = 3)->list:
|
|
| 34 |
return ayats
|
| 35 |
|
| 36 |
except Exception as e:
|
| 37 |
-
|
| 38 |
|
| 39 |
|
| 40 |
|
|
|
|
| 11 |
@tool
|
| 12 |
def get_ayyahs(word:str,required_instances:int = 3)->list:
|
| 13 |
"""
|
| 14 |
+
Retrieves occurrences of a given word in the Quran and returns a list of ayahs.
|
| 15 |
+
|
| 16 |
Args:
|
| 17 |
+
word (str): The word to search for in the Quran.
|
| 18 |
+
required_instances (int, optional): The number of occurrences to return.
|
| 19 |
+
Defaults to 3. If fewer occurrences
|
| 20 |
+
exist, all available results are returned.
|
| 21 |
+
|
| 22 |
+
Returns:
|
| 23 |
+
list: A list of tuples containing:
|
| 24 |
+
- The ayah (verse) text (str)
|
| 25 |
+
- The Surah name in Arabic (str)
|
| 26 |
+
- The Surah name in English (str)
|
| 27 |
+
- The ayah number in the Surah (int)
|
| 28 |
+
|
| 29 |
+
If an error occurs, returns an error message (str).
|
| 30 |
"""
|
| 31 |
ayats = []
|
| 32 |
url = f"http://api.alquran.cloud/v1/search/{word}/all/en.asad"
|
|
|
|
| 46 |
return ayats
|
| 47 |
|
| 48 |
except Exception as e:
|
| 49 |
+
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 50 |
|
| 51 |
|
| 52 |
|