Cristóbal Hernández commited on
Commit
b52f045
·
1 Parent(s): 5f7e8bd

Add application file

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -121,14 +121,8 @@ def classify_output(item):
121
  ######## RUN GRADIO APP #################
122
  #########################################
123
 
124
- txtbx = gr.Textbox(value = 'I would like to feel better', label = 'Please enter your item:', container = 'True')
125
- txtbxopt = gr.Textbox(label = 'The item you provided was classified as:', container = 'True')
126
- hf_writer = gr.HuggingFaceDatasetSaver(api_key, 'flagging_EEMM_V05')
127
- demo = gr.Interface(fn=classify_output, inputs=txtbx, outputs=txtbxopt,
128
- theme = gr.themes.Soft(primary_hue='orange'),
129
- title = 'EEMM Item Classification Machine V 0.5',
130
- description = 'This machine is a fine tuned version of DistillBERT. It classifies items in 7 EEMM dimensions following (ref). **Please note that the machine goes idle after a period of inactivity. If this occurs, waking it up may take around 20 seconds. Be patient ;)**',
131
- article = gr.Markdown("""
132
  ## Affect/Emotion
133
  This category is concerned with how people feel or respond to emotions. It includes bodily sensations. Inner Experience described as pleasant or unpleasant. Sentences with words relating to emotions, feelings, affect, or mood. Sentences about avoiding, suppressing, getting rid of, or controlling emotions. Phrases that indicate an intense emotional response belong here: e.g., I can't stand it, it is unbearable, it is intolerable.
134
 
@@ -140,7 +134,16 @@ Sentences that discuss what people are focusing on or paying attention to, inclu
140
 
141
  ## Motivation
142
  Statements focusing on what drives actions or behaviors. Includes stating what one values, expressing the desire to achieve particular goals, or giving reasons for acting, such as compliance or values. Also about wishing or hoping for something, which implies value. Phrases about "not caring for *something*" relates to motivation. Sentences about wanting to give up or escape may also imply motivation, e.g., escaping an aversive or an absence of motivation.
143
- """),
 
 
 
 
 
 
 
 
 
144
  allow_flagging = 'manual',
145
  flagging_options = ['Wrong category','Lacks a category'],
146
  flagging_callback= hf_writer
 
121
  ######## RUN GRADIO APP #################
122
  #########################################
123
 
124
+
125
+ article_text = """
 
 
 
 
 
 
126
  ## Affect/Emotion
127
  This category is concerned with how people feel or respond to emotions. It includes bodily sensations. Inner Experience described as pleasant or unpleasant. Sentences with words relating to emotions, feelings, affect, or mood. Sentences about avoiding, suppressing, getting rid of, or controlling emotions. Phrases that indicate an intense emotional response belong here: e.g., I can't stand it, it is unbearable, it is intolerable.
128
 
 
134
 
135
  ## Motivation
136
  Statements focusing on what drives actions or behaviors. Includes stating what one values, expressing the desire to achieve particular goals, or giving reasons for acting, such as compliance or values. Also about wishing or hoping for something, which implies value. Phrases about "not caring for *something*" relates to motivation. Sentences about wanting to give up or escape may also imply motivation, e.g., escaping an aversive or an absence of motivation.
137
+ """
138
+
139
+ txtbx = gr.Textbox(value = 'I would like to feel better', label = 'Please enter your item:', container = 'True')
140
+ txtbxopt = gr.Textbox(label = 'The item you provided was classified as:', container = 'True')
141
+ hf_writer = gr.HuggingFaceDatasetSaver(api_key, 'flagging_EEMM_V05')
142
+ demo = gr.Interface(fn=classify_output, inputs=txtbx, outputs=txtbxopt,
143
+ theme = gr.themes.Soft(primary_hue='orange'),
144
+ title = 'EEMM Item Classification Machine V 0.5',
145
+ description = 'This machine is a fine tuned version of DistillBERT. It classifies items in 7 EEMM dimensions following (ref). **Please note that the machine goes idle after a period of inactivity. If this occurs, waking it up may take around 20 seconds. Be patient ;)**',
146
+ article = article_text,
147
  allow_flagging = 'manual',
148
  flagging_options = ['Wrong category','Lacks a category'],
149
  flagging_callback= hf_writer