azaninello commited on
Commit
b096b37
1 Parent(s): 9abc3fa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -2
app.py CHANGED
@@ -1,5 +1,5 @@
1
  import gradio as gr
2
-
3
  import nltk
4
  import simplemma
5
  from nltk.tokenize import word_tokenize
@@ -7,7 +7,44 @@ from nltk.tokenize import sent_tokenize
7
  from nltk.probability import FreqDist
8
  from simplemma import text_lemmatizer
9
  nltk.download('punkt')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
 
11
  def update(name):
12
  return f"Welcome to Gradio, {name}!"
13
 
@@ -53,7 +90,7 @@ def get_lists(file):
53
  words, words_lower, SENTENCES, SENTENCES_LOWER = get_lists(file)
54
 
55
 
56
- '''
57
  def num_sentences(show=''):
58
  try:
59
  number = int(show)
 
1
  import gradio as gr
2
+ '''
3
  import nltk
4
  import simplemma
5
  from nltk.tokenize import word_tokenize
 
7
  from nltk.probability import FreqDist
8
  from simplemma import text_lemmatizer
9
  nltk.download('punkt')
10
+ '''
11
+
12
+ def sentence(cerca_una_parola):
13
+ return f"""La parola da cercare è {cerca_una_parola}}"""
14
+
15
+
16
+ def upper(cerca_una_parola):
17
+ return cerca_una_parola.upper()
18
+
19
+ demo = fr.Textbox(fn=sentence, inputs='text', outputs='text')
20
+ demo.launch()
21
+
22
+ demo2 = fr.Textbox(fn=upper, inputs='text', outputs='text')
23
+ demo2.launch()
24
+
25
+ '''
26
+ demo = gr.Interface(
27
+ sentence_builder,
28
+ [
29
+ gr.Textbox(),
30
+ gr.Radio(["park", "zoo", "road"]),
31
+ gr.CheckboxGroup(["ran", "swam", "ate", "slept"]),
32
+ gr.Checkbox(label="Is it the morning?"),
33
+ ],
34
+ "text",
35
+ examples=[
36
+ ["cats", "park", ["ran", "swam"], True],
37
+ ["dog", "zoo", ["ate", "swam"], False],
38
+ ["bird", "road", ["ran"], False],
39
+ ["cat", "zoo", ["ate"], True],
40
+ ],
41
+ )
42
+
43
+
44
+ '''
45
+
46
 
47
+ '''
48
  def update(name):
49
  return f"Welcome to Gradio, {name}!"
50
 
 
90
  words, words_lower, SENTENCES, SENTENCES_LOWER = get_lists(file)
91
 
92
 
93
+
94
  def num_sentences(show=''):
95
  try:
96
  number = int(show)