alihmaou commited on
Commit
8ca1104
·
verified ·
1 Parent(s): b835114

Upload tools/multiplication.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. tools/multiplication.py +27 -0
tools/multiplication.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import json
3
+ from PIL import Image
4
+ import numpy as np
5
+
6
+ # --- User Defined Logic ---
7
+ def multiplication(a: str, b: str) -> float:
8
+ """Renvoie la multiplication de deux nombres soumis (prévoir conversion en nombre).
9
+
10
+ Args:
11
+ a: Premier nombre à multiplier (chaîne convertible en nombre).
12
+ b: Deuxième nombre à multiplier (chaîne convertible en nombre).
13
+
14
+ Returns:
15
+ Le produit des deux nombres convertis en float.
16
+ """
17
+ return float(a) * float(b)
18
+
19
+ # --- Interface Factory ---
20
+ def create_interface():
21
+ return gr.Interface(
22
+ fn=multiplication,
23
+ inputs=[gr.Textbox(label=k) for k in ['a', 'b']],
24
+ outputs=gr.Textbox(label="Résultat de la multiplication"),
25
+ title="multiplication",
26
+ description="Auto-generated tool: multiplication"
27
+ )