MJ commited on
Commit
824c411
·
1 Parent(s): ee41f8a

Potential fix for markdown format

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -6,10 +6,12 @@ def run_model(text_in, model_in):
6
  classifier = pipeline(task="sentiment-analysis",
7
  model=model_in)
8
  analysis = classifier(text_in)
 
9
  for output in analysis:
10
- to_output = "Sentiment: ", output["label"], " Confidence Score: ", "{0:.2g}".format(
11
- output["score"] * 100)
12
- st.markdown(to_output)
 
13
 
14
 
15
  models_available = {"Roberta Large English": "siebert/sentiment-roberta-large-english",
@@ -24,3 +26,6 @@ model_picked = st.selectbox(
24
 
25
  st.button("Submit", on_click=run_model, args=(
26
  text_input, models_available[model_picked]))
 
 
 
 
6
  classifier = pipeline(task="sentiment-analysis",
7
  model=model_in)
8
  analysis = classifier(text_in)
9
+ to_output = ""
10
  for output in analysis:
11
+ to_output += "Sentiment: ", output["label"], " Confidence Score: ", "{0:.2f}".format(
12
+ output["score"] * 100), "\n"
13
+ global markdown_text
14
+ markdown_text = to_output
15
 
16
 
17
  models_available = {"Roberta Large English": "siebert/sentiment-roberta-large-english",
 
26
 
27
  st.button("Submit", on_click=run_model, args=(
28
  text_input, models_available[model_picked]))
29
+
30
+ if len(markdown_text) > 0:
31
+ st.markdown(body=markdown_text)