alihmaou commited on
Commit
1e8b999
·
1 Parent(s): 5a6b27d

Lambda commit

Browse files
Files changed (4) hide show
  1. app.py +6 -4
  2. tools/datasetananalysis.py +10 -0
  3. tools/jokes.py +34 -0
  4. tools/weather.py +0 -0
app.py CHANGED
@@ -1,15 +1,17 @@
1
  import gradio as gr
2
- from tools import jokes, weather
3
 
4
 
5
  demo = gr.TabbedInterface(
6
  [
7
- gr.Interface(fn=jokes.smalljoke,inputs=["text"],outputs="text", title="Small joke teller", description="Tell a small joke in french"),
8
- gr.Interface(fn=jokes.longjoke,inputs=["text","text","text","text" ],outputs="text", title="Long joke teller", description="Tell a longer joke in french")
 
9
  ],
10
  [
11
  "Histoire courte",
12
- "Histoire longue"
 
13
  ]
14
  )
15
 
 
1
  import gradio as gr
2
+ from tools import jokes, weather, dataananalysis
3
 
4
 
5
  demo = gr.TabbedInterface(
6
  [
7
+ gr.Interface(fn=jokes.smalljoke,inputs=["text"],outputs="text", title="Small joke teller", description="Tells a small joke in french"),
8
+ gr.Interface(fn=jokes.longjoke,inputs=["text","text","text","text" ],outputs="text", title="Long joke teller", description="Tells a longer joke in french"),
9
+ gr.Interface(fn=jokes.longjoke,inputs=["text" ],outputs="text", title="Dataset descriptor", description="Provides a usefull description of a dataset to allow content and structure awareness before SQL requesting on it.")
10
  ],
11
  [
12
  "Histoire courte",
13
+ "Histoire longue",
14
+ "Analyse d'un dataset"
15
  ]
16
  )
17
 
tools/datasetananalysis.py ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ def smalljoke(dataseturl):
2
+ """Provides a usefull description of a dataset to allow content and structure awareness before SQL requesting on it.
3
+
4
+ Args:
5
+ dataseturl: url to the dataset as a file
6
+
7
+ Returns:
8
+ A usefull description of a dataset to allow content and structure awareness before SQL requesting on it
9
+ """
10
+ return f"Tableau de 100l ligne colonnes : A; B; D; F"
tools/jokes.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def smalljoke(sujet):
2
+ """Tell a small joke in french.
3
+
4
+ Args:
5
+ theme: theme of the joke
6
+
7
+ Returns:
8
+ A joke in french that goes along with the theme
9
+ """
10
+ return f"Tu connais paf le {sujet} ? C'est l'histoire d'un {sujet} qui traverse la route et paf le {sujet} !"
11
+
12
+
13
+ def longjoke(sujet, animal="hibou", ville="Ploumegouze", obstacle="vitre automatique"):
14
+ """Tell a long, surreal French joke using the given parameters.
15
+
16
+ Args:
17
+ theme: central subject of the joke (used as character)
18
+ animal: animal giving a warning
19
+ ville: destination of the character
20
+ obstacle: object the character crashes into
21
+
22
+ Returns:
23
+ A long, themed joke in French
24
+ """
25
+ return (
26
+ f"C’est l’histoire d’un {sujet} qui en avait marre de sa routine. Un jour, il se dit : "
27
+ f"‘Fini les journées à glander, je pars à {ville}, là-bas tout est possible.’\n"
28
+ f"En chemin, il croise un {animal} perché sur un poteau téléphonique, qui le regarde fixement et dit : "
29
+ f"‘{sujet}, méfie-toi. Là où tu vas, les choses ne sont pas toujours ce qu’elles semblent.’\n"
30
+ f"Mais le {sujet} hausse les épaules et poursuit sa route.\n"
31
+ f"Arrivé à {ville}, des étoiles plein les yeux, il voit les portes du centre commercial s’ouvrir. "
32
+ f"Enfin presque. Parce qu’au lieu de s’ouvrir… PAF. Il se prend une {obstacle} en pleine face.\n\n"
33
+ f"Morale : écouter un {animal}, ça évite les carreaux dans la tronche."
34
+ )
tools/weather.py ADDED
File without changes