mymllearner commited on
Commit
b9631e6
·
verified ·
1 Parent(s): 553e8d6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py CHANGED
@@ -7,6 +7,26 @@ from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
 
12
  @tool
 
7
 
8
  from Gradio_UI import GradioUI
9
 
10
+ # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
+ @tool
12
+ def combine(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
+ #Keep this format for the description / args / args description but feel free to modify the tool
14
+ """A tool that combines two parameters. It checks if the arguments contain integers or numbers and adds those two if they both are candidates for mathematical addition.
15
+ Otherwise returns a concatenated string
16
+ Args:
17
+ arg1: the first argument
18
+ arg2: the second argument
19
+ """
20
+ def check_int(s):
21
+ if s[0] in ('-', '+'):
22
+ return s[1:].isdigit()
23
+ return s.isdigit()
24
+ final_var = ""
25
+ if check_int(arg1) == True and check_int(arg2) == True:
26
+ final_var = str(arg1+arg2)
27
+ else:
28
+ final_var = str(arg1)+str(arg2)
29
+ return final_var
30
 
31
 
32
  @tool