Update app.py
Browse files
app.py
CHANGED
@@ -173,6 +173,9 @@ def process_ner_data(your_bot_token):
|
|
173 |
def process_classifier_ner_data(your_bot_token):
|
174 |
return get_classifier_ner(your_bot_token)
|
175 |
|
|
|
|
|
|
|
176 |
|
177 |
demo = gr.Blocks()
|
178 |
|
@@ -188,6 +191,7 @@ with demo:
|
|
188 |
classifier_ner_button = gr.Button("Get Classifier-NER Output")
|
189 |
ner_button = gr.Button("Get NER Output")
|
190 |
clear = gr.Button("Clear")
|
|
|
191 |
|
192 |
with gr.TabItem("User Guide"):
|
193 |
with gr.Row():
|
@@ -213,7 +217,8 @@ with demo:
|
|
213 |
|
214 |
ner_button.click(process_ner_data,inputs=your_bot_token, outputs=ner_df)
|
215 |
classifier_ner_button.click(process_classifier_ner_data,inputs=your_bot_token, outputs=ner_df)
|
216 |
-
clear.click(lambda: None, None, ner_df, queue=True)
|
|
|
217 |
|
218 |
demo.queue(concurrency_count=3)
|
219 |
demo.launch() # share=True, debug=True
|
|
|
173 |
def process_classifier_ner_data(your_bot_token):
|
174 |
return get_classifier_ner(your_bot_token)
|
175 |
|
176 |
+
def export_csv(d):
|
177 |
+
d.to_csv("output.csv")
|
178 |
+
return gr.File.update(value="output.csv", visible=True)
|
179 |
|
180 |
demo = gr.Blocks()
|
181 |
|
|
|
191 |
classifier_ner_button = gr.Button("Get Classifier-NER Output")
|
192 |
ner_button = gr.Button("Get NER Output")
|
193 |
clear = gr.Button("Clear")
|
194 |
+
export = gr.Button("Export")
|
195 |
|
196 |
with gr.TabItem("User Guide"):
|
197 |
with gr.Row():
|
|
|
217 |
|
218 |
ner_button.click(process_ner_data,inputs=your_bot_token, outputs=ner_df)
|
219 |
classifier_ner_button.click(process_classifier_ner_data,inputs=your_bot_token, outputs=ner_df)
|
220 |
+
clear.click(lambda: None, None, ner_df, queue=True)
|
221 |
+
export.click(export_csv, inputs=ner_df, outputs=ner_df)
|
222 |
|
223 |
demo.queue(concurrency_count=3)
|
224 |
demo.launch() # share=True, debug=True
|