Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -27,16 +27,16 @@ def generate_jokes(joke_type:str)-> str: #it's import to specify the return type
|
|
| 27 |
Args:
|
| 28 |
joke_type: a string that specifies the type of joke to retrieve. Accepted arguments 'dad' or 'regular'
|
| 29 |
"""
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
| 41 |
return random_example
|
| 42 |
|
|
|
|
| 27 |
Args:
|
| 28 |
joke_type: a string that specifies the type of joke to retrieve. Accepted arguments 'dad' or 'regular'
|
| 29 |
"""
|
| 30 |
+
if joke_type == 'dad':
|
| 31 |
+
path = 'gnumanth/dad-jokes'
|
| 32 |
+
col = 'joke'
|
| 33 |
+
else:
|
| 34 |
+
path = 'Amirkid/jokes'
|
| 35 |
+
col = 'text'
|
| 36 |
+
dataset = load_dataset(path, split = "train")[col]
|
| 37 |
+
# shuffle to make sure examples will be random
|
| 38 |
+
dataset = dataset.shuffle()
|
| 39 |
+
random_example = dataset[[col]][0]
|
| 40 |
|
| 41 |
return random_example
|
| 42 |
|