thushalya commited on
Commit
661f21a
1 Parent(s): 6907c28

Add emotion graph

Browse files
Files changed (1) hide show
  1. app.py +21 -13
app.py CHANGED
@@ -378,17 +378,17 @@ def greet(tweet):
378
  "values": preemotion_list,
379
  }
380
  )
381
- with gr.Blocks() as bar_plot:
382
- bar_plot.load(outputs= gr.BarPlot(
383
- simple,
384
- x="Emotions",
385
- y="Values",
386
- title="Simple Bar Plot with made up data",
387
- tooltip=["a", "b"],
388
- y_lim=[20, 100],
389
- ))
390
-
391
- bar_plot.launch()
392
 
393
  prediction_value = round(prediction.item(),2)
394
  # features_list = extract_features(tweet)
@@ -405,7 +405,7 @@ def greet(tweet):
405
  label = "Hate"
406
 
407
 
408
- return label,str(prediction_value)+"%",str(1-prediction_value)+"%"
409
 
410
  # demo = gr.Interface(fn=greet, inputs="text", outputs="text")
411
  demo = gr.Interface(
@@ -415,7 +415,15 @@ demo = gr.Interface(
415
  allow_flagging = "never",outputs=[
416
  gr.Label(label="Label"),
417
  gr.Textbox(label="Hate Speech Percentage"),
418
- gr.Textbox(label="Non Hate Speech Percentage")
 
 
 
 
 
 
 
 
419
  ],
420
  examples=[
421
  ["I like you"],
 
378
  "values": preemotion_list,
379
  }
380
  )
381
+ # with gr.Blocks() as bar_plot:
382
+ # bar_plot.load(outputs= gr.BarPlot(
383
+ # simple,
384
+ # x="Emotions",
385
+ # y="Values",
386
+ # title="Simple Bar Plot with made up data",
387
+ # tooltip=["a", "b"],
388
+ # y_lim=[20, 100],
389
+ # ))
390
+
391
+ # bar_plot.launch()
392
 
393
  prediction_value = round(prediction.item(),2)
394
  # features_list = extract_features(tweet)
 
405
  label = "Hate"
406
 
407
 
408
+ return label,str(prediction_value)+"%",str(1-prediction_value)+"%",simple
409
 
410
  # demo = gr.Interface(fn=greet, inputs="text", outputs="text")
411
  demo = gr.Interface(
 
415
  allow_flagging = "never",outputs=[
416
  gr.Label(label="Label"),
417
  gr.Textbox(label="Hate Speech Percentage"),
418
+ gr.Textbox(label="Non Hate Speech Percentage"),
419
+ gr.BarPlot(
420
+ simple,
421
+ x="Emotions",
422
+ y="Values",
423
+ title="Simple Bar Plot with made up data",
424
+ tooltip=["a", "b"],
425
+ y_lim=[20, 100],
426
+ )
427
  ],
428
  examples=[
429
  ["I like you"],