tomp61 commited on
Commit
c29ec05
·
1 Parent(s): 035ccca

fixed typos

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -10,7 +10,7 @@ def analyze_text(text):
10
 
11
  sentiment = blob.sentiment.polarity
12
 
13
- word_count = len(split(text))
14
  char_count = len(text)
15
 
16
  avg_word_length = char_count / word_count
@@ -19,7 +19,7 @@ def analyze_text(text):
19
  "sentiment_score": round(sentiment, 2),
20
  "word_count": word_count,
21
  "char_count": char_count,
22
- "avg_word_length": rount(avg_word_length, 2)
23
  }
24
 
25
  with gr.Blocks() as demo:
@@ -27,14 +27,14 @@ with gr.Blocks() as demo:
27
  gr.Markdown("Enter some text to analyze its sentiment and get basic statistics.")
28
 
29
  with gr.Row():
30
- text_input = gr.TextBox(
31
  label = "Input Text",
32
  placeholder = "Type your text here...",
33
  lines = 5,
34
  )
35
 
36
  with gr.Row():
37
- analyse_button = gr..Button("Analyze")
38
 
39
  with gr.Row():
40
  sentiment_output = gr.Number(label="Sentiment Score (-1 to 1)")
@@ -43,7 +43,7 @@ with gr.Blocks() as demo:
43
  avg_length_output = gr.Number(label = "Average Word Length")
44
 
45
  analyze_button.click(
46
- fn=analyse_text,
47
  inputs=text_input,
48
  outputs=[
49
  sentiment_output,
@@ -54,4 +54,4 @@ with gr.Blocks() as demo:
54
  )
55
 
56
  if __name__ == '__main__':
57
- demo.launch():
 
10
 
11
  sentiment = blob.sentiment.polarity
12
 
13
+ word_count = len(text.split())
14
  char_count = len(text)
15
 
16
  avg_word_length = char_count / word_count
 
19
  "sentiment_score": round(sentiment, 2),
20
  "word_count": word_count,
21
  "char_count": char_count,
22
+ "avg_word_length": round(avg_word_length, 2)
23
  }
24
 
25
  with gr.Blocks() as demo:
 
27
  gr.Markdown("Enter some text to analyze its sentiment and get basic statistics.")
28
 
29
  with gr.Row():
30
+ text_input = gr.Textbox(
31
  label = "Input Text",
32
  placeholder = "Type your text here...",
33
  lines = 5,
34
  )
35
 
36
  with gr.Row():
37
+ analyze_button = gr.Button("Analyze")
38
 
39
  with gr.Row():
40
  sentiment_output = gr.Number(label="Sentiment Score (-1 to 1)")
 
43
  avg_length_output = gr.Number(label = "Average Word Length")
44
 
45
  analyze_button.click(
46
+ fn=analyze_text,
47
  inputs=text_input,
48
  outputs=[
49
  sentiment_output,
 
54
  )
55
 
56
  if __name__ == '__main__':
57
+ demo.launch()