Spaces:
Running
Running
Commit
·
2ed293a
1
Parent(s):
fd133b0
Update app.py
Browse files
app.py
CHANGED
@@ -109,33 +109,24 @@ def inference_sentence(text):
|
|
109 |
output = "This sentence will be processed:\n" + text
|
110 |
return output
|
111 |
|
112 |
-
def inference_dataset(
|
113 |
output1="Here you will be able to download a file."
|
114 |
output2 = output3 = output4 = output5 = "This option was not selected."
|
115 |
-
if "emotion frequencies" in
|
116 |
-
output2 = "This option was selected."
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
|
|
|
|
|
|
|
|
125 |
|
126 |
-
"""
|
127 |
-
inputs = [gr.File(
|
128 |
-
label="Upload a dataset"),
|
129 |
-
gr.CheckboxGroup(
|
130 |
-
["emotion frequencies", "emotion distribution over time", "peaks", "topics"],
|
131 |
-
label = "Select options")]
|
132 |
-
|
133 |
-
outputs = [gr.File(),
|
134 |
-
gr.Plot(label="Emotion frequencies"),
|
135 |
-
gr.Textbox(label="Emotion distribution over time"),
|
136 |
-
gr.Textbox(label="Peaks"),
|
137 |
-
gr.Textbox(label="Topics")]
|
138 |
-
"""
|
139 |
|
140 |
with gr.Blocks() as demo:
|
141 |
with gr.Tab("Sentence"):
|
@@ -166,11 +157,11 @@ with gr.Blocks() as demo:
|
|
166 |
send_btn = gr.Button("Send")
|
167 |
with gr.Column():
|
168 |
output_file = gr.Textbox()
|
169 |
-
output_plot = gr.Textbox()
|
170 |
-
output_dist = gr.Textbox()
|
171 |
-
output_peaks = gr.Textbox()
|
172 |
-
output_topics = gr.Textbox()
|
173 |
-
send_btn.click(fn=inference_dataset, inputs=
|
174 |
|
175 |
demo.launch()
|
176 |
|
|
|
109 |
output = "This sentence will be processed:\n" + text
|
110 |
return output
|
111 |
|
112 |
+
def inference_dataset(input_file, input_checks):
|
113 |
output1="Here you will be able to download a file."
|
114 |
output2 = output3 = output4 = output5 = "This option was not selected."
|
115 |
+
if "emotion frequencies" in input_checks:
|
116 |
+
output2 = gr.Textbox(value="This option was selected.", visible=True)
|
117 |
+
#output2 = "This option was selected."
|
118 |
+
if "emotion distribution over time" in input_checks:
|
119 |
+
output3 = gr.Textbox(value="This option was selected.", visible=True)
|
120 |
+
if "peaks" in input_checks:
|
121 |
+
output4 = gr.Textbox(value="This option was selected.", visible=True)
|
122 |
+
if "topics" in input_checks:
|
123 |
+
output5 = gr.Textbox(value="This option was selected.", visible=True)
|
124 |
+
return {output1,
|
125 |
+
output2,
|
126 |
+
output3,
|
127 |
+
output4,
|
128 |
+
output5}
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
|
131 |
with gr.Blocks() as demo:
|
132 |
with gr.Tab("Sentence"):
|
|
|
157 |
send_btn = gr.Button("Send")
|
158 |
with gr.Column():
|
159 |
output_file = gr.Textbox()
|
160 |
+
output_plot = gr.Textbox(visible=False)
|
161 |
+
output_dist = gr.Textbox(visible=False)
|
162 |
+
output_peaks = gr.Textbox(visible=False)
|
163 |
+
output_topics = gr.Textbox(visible=False)
|
164 |
+
send_btn.click(fn=inference_dataset, inputs=[input_file,input_checks], outputs=[output_file,output_plot,output_dist,output_peaks,output_topics])
|
165 |
|
166 |
demo.launch()
|
167 |
|