Spaces:
Running
Running
Commit
·
b59d991
1
Parent(s):
5d12990
Update app.py
Browse files
app.py
CHANGED
@@ -109,8 +109,24 @@ def inference_sentence(text):
|
|
109 |
output = "This sentence will be processed:\n" + text
|
110 |
return output
|
111 |
|
|
|
|
|
|
|
|
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
|
|
|
|
|
|
|
|
|
|
|
|
114 |
|
115 |
with gr.Blocks() as demo:
|
116 |
with gr.Tab("Sentence"):
|
@@ -129,16 +145,18 @@ with gr.Blocks() as demo:
|
|
129 |
with gr.Tab("Dataset"):
|
130 |
gr.Markdown("""
|
131 |
# Demo EmotioNL
|
132 |
-
This demo allows you to analyse the
|
133 |
""")
|
134 |
with gr.Row():
|
135 |
with gr.Column():
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
|
|
|
|
140 |
output = gr.Textbox()
|
141 |
-
send_btn.click(fn=inference_sentence, inputs=
|
142 |
|
143 |
demo.launch()
|
144 |
|
|
|
109 |
output = "This sentence will be processed:\n" + text
|
110 |
return output
|
111 |
|
112 |
+
def inference_dataset(path):
|
113 |
+
output = "This dataset will be processed:\n" + path
|
114 |
+
return output
|
115 |
+
|
116 |
|
117 |
+
"""
|
118 |
+
inputs = [gr.File(
|
119 |
+
label="Upload a dataset"),
|
120 |
+
gr.CheckboxGroup(
|
121 |
+
["emotion frequencies", "emotion distribution over time", "peaks", "topics"],
|
122 |
+
label = "Select options")]
|
123 |
|
124 |
+
outputs = [gr.File(),
|
125 |
+
gr.Plot(label="Emotion frequencies"),
|
126 |
+
gr.Textbox(label="Emotion distribution over time"),
|
127 |
+
gr.Textbox(label="Peaks"),
|
128 |
+
gr.Textbox(label="Topics")]
|
129 |
+
"""
|
130 |
|
131 |
with gr.Blocks() as demo:
|
132 |
with gr.Tab("Sentence"):
|
|
|
145 |
with gr.Tab("Dataset"):
|
146 |
gr.Markdown("""
|
147 |
# Demo EmotioNL
|
148 |
+
This demo allows you to analyse the emotions in a dataset. The data should be in tsv-format with two named columns: the first column (id) should contain the sentence IDs, and the second column (text) should contain the actual texts. Optionally, there is a third column named 'date', which specifies the date associated with the text (e.g., tweet date). This column is necessary when the options 'emotion distribution over time' and 'peaks' are selected.
|
149 |
""")
|
150 |
with gr.Row():
|
151 |
with gr.Column():
|
152 |
+
input_file = gr.File(
|
153 |
+
label="Upload a dataset"),
|
154 |
+
send_btn = gr.Button("Send")
|
155 |
+
input_checks = gr.CheckboxGroup(
|
156 |
+
["emotion frequencies", "emotion distribution over time", "peaks", "topics"],
|
157 |
+
label = "Select options")
|
158 |
output = gr.Textbox()
|
159 |
+
send_btn.click(fn=inference_sentence, inputs=input_file, outputs=output)
|
160 |
|
161 |
demo.launch()
|
162 |
|