David Kagramanyan commited on
Commit
d250f9f
1 Parent(s): 59403ae
Files changed (2) hide show
  1. app.py +3 -2
  2. classifier.ipynb +4 -2
app.py CHANGED
@@ -27,7 +27,7 @@ def classify(input_text_message: str):
27
 
28
  logger.info(time.strftime("%Y.%m.%d, %H:%M:%S")+' '+'result '+str(confidences))
29
 
30
- return confidences
31
 
32
  labels = ['eastern armenian', 'western armenian', 'grabar (classic) armenian']
33
 
@@ -55,12 +55,13 @@ with gr.Blocks() as demo:
55
  with gr.Row():
56
  text_input = gr.Textbox(lines=2, placeholder="Enter your text here")
57
  rec_output = gr.Label(label='Labels', num_top_classes=3)
 
58
 
59
  text_button = gr.Button("Define dialect group")
60
  examples_block = gr.Examples(examples=examples,
61
  inputs=[text_input], )
62
 
63
  text_button.click(classify, inputs=text_input,
64
- outputs=[rec_output])
65
 
66
  demo.launch(share=False, debug=True)
 
27
 
28
  logger.info(time.strftime("%Y.%m.%d, %H:%M:%S")+' '+'result '+str(confidences))
29
 
30
+ return confidences, len(words)
31
 
32
  labels = ['eastern armenian', 'western armenian', 'grabar (classic) armenian']
33
 
 
55
  with gr.Row():
56
  text_input = gr.Textbox(lines=2, placeholder="Enter your text here")
57
  rec_output = gr.Label(label='Labels', num_top_classes=3)
58
+ txt_output=gr.Textbox(label='Number of words')
59
 
60
  text_button = gr.Button("Define dialect group")
61
  examples_block = gr.Examples(examples=examples,
62
  inputs=[text_input], )
63
 
64
  text_button.click(classify, inputs=text_input,
65
+ outputs=[rec_output,txt_output])
66
 
67
  demo.launch(share=False, debug=True)
classifier.ipynb CHANGED
@@ -38,6 +38,7 @@
38
  "\n",
39
  "\n",
40
  "words=preprocess(text)\n",
 
41
  "desc_lexical=get_lexical_desc(words).reshape((1,-1))\n",
42
  "desc_morphemic=get_morphemic_desc(words).reshape((1,-1))\n",
43
  "\n",
@@ -71,7 +72,7 @@
71
  "\n",
72
  " logger.info(time.strftime(\"%Y.%m.%d, %H:%M:%S\")+' '+'result '+str(confidences))\n",
73
  " \n",
74
- " return confidences\n",
75
  "\n",
76
  "labels = ['eastern armenian', 'western armenian', 'grabar (classic) armenian']\n",
77
  "\n",
@@ -99,13 +100,14 @@
99
  " with gr.Row():\n",
100
  " text_input = gr.Textbox(lines=2, placeholder=\"Enter your text here\")\n",
101
  " rec_output = gr.Label(label='Labels', num_top_classes=3)\n",
 
102
  " \n",
103
  " text_button = gr.Button(\"Define dialect group\")\n",
104
  " examples_block = gr.Examples(examples=examples,\n",
105
  " inputs=[text_input], )\n",
106
  "\n",
107
  " text_button.click(classify, inputs=text_input,\n",
108
- " outputs=[rec_output])\n",
109
  "\n",
110
  "\n",
111
  "\n",
 
38
  "\n",
39
  "\n",
40
  "words=preprocess(text)\n",
41
+ "print(len(words))\n",
42
  "desc_lexical=get_lexical_desc(words).reshape((1,-1))\n",
43
  "desc_morphemic=get_morphemic_desc(words).reshape((1,-1))\n",
44
  "\n",
 
72
  "\n",
73
  " logger.info(time.strftime(\"%Y.%m.%d, %H:%M:%S\")+' '+'result '+str(confidences))\n",
74
  " \n",
75
+ " return confidences, len(words)\n",
76
  "\n",
77
  "labels = ['eastern armenian', 'western armenian', 'grabar (classic) armenian']\n",
78
  "\n",
 
100
  " with gr.Row():\n",
101
  " text_input = gr.Textbox(lines=2, placeholder=\"Enter your text here\")\n",
102
  " rec_output = gr.Label(label='Labels', num_top_classes=3)\n",
103
+ " txt_output=gr.Textbox(label='Number of words')\n",
104
  " \n",
105
  " text_button = gr.Button(\"Define dialect group\")\n",
106
  " examples_block = gr.Examples(examples=examples,\n",
107
  " inputs=[text_input], )\n",
108
  "\n",
109
  " text_button.click(classify, inputs=text_input,\n",
110
+ " outputs=[rec_output,txt_output])\n",
111
  "\n",
112
  "\n",
113
  "\n",