Abdullah104 commited on
Commit
f6c68bf
·
verified ·
1 Parent(s): 47e5be2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -4
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
- A tool that get all the occurence of a given word in quran
 
15
  Args:
16
- word: Word to find
17
- required_instances: Number of instances of the word to return, default is 3.
 
 
 
 
 
 
 
 
 
 
 
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
- print(f"Problem in get_ayyahs functions: {e}")
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