Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -301,6 +301,9 @@ def text_classification_and_sentiment(text, keywords_df):
|
|
| 301 |
sentiment_output = f"Sentiment: {sentiment_label}\nProbability: {sentiment_score * 100:.2f}%"
|
| 302 |
decision_output = f"Decision: {decision}"
|
| 303 |
|
|
|
|
|
|
|
|
|
|
| 304 |
return tpb_output, sentiment_output, decision_output
|
| 305 |
|
| 306 |
|
|
@@ -382,9 +385,9 @@ with gr.Blocks(css=css + """
|
|
| 382 |
# This needs to be called at some point prior to the first call to callback.flag()
|
| 383 |
hf_writer.setup([input_text,tpb_output, sentiment_output], "flagged_data_points")
|
| 384 |
classify_button = gr.Button("Analyze")
|
| 385 |
-
classify_button.click(lambda *args: hf_writer.flag(list(args)),fn=text_classification_and_sentiment, inputs=input_text, outputs=[tpb_output, sentiment_output, decision_output])
|
| 386 |
-
gr.Examples(examples=examples, inputs=input_text)
|
| 387 |
|
|
|
|
|
|
|
| 388 |
|
| 389 |
|
| 390 |
with gr.TabItem("Company View", id=1):
|
|
|
|
| 301 |
sentiment_output = f"Sentiment: {sentiment_label}\nProbability: {sentiment_score * 100:.2f}%"
|
| 302 |
decision_output = f"Decision: {decision}"
|
| 303 |
|
| 304 |
+
hf_writer.flag([text,tpb_output, sentiment_output])
|
| 305 |
+
|
| 306 |
+
|
| 307 |
return tpb_output, sentiment_output, decision_output
|
| 308 |
|
| 309 |
|
|
|
|
| 385 |
# This needs to be called at some point prior to the first call to callback.flag()
|
| 386 |
hf_writer.setup([input_text,tpb_output, sentiment_output], "flagged_data_points")
|
| 387 |
classify_button = gr.Button("Analyze")
|
|
|
|
|
|
|
| 388 |
|
| 389 |
+
classify_button.click(fn=text_classification_and_sentiment, inputs=input_text, outputs=[tpb_output, sentiment_output, decision_output])
|
| 390 |
+
gr.Examples(examples=examples, inputs=input_text)
|
| 391 |
|
| 392 |
|
| 393 |
with gr.TabItem("Company View", id=1):
|