GradApplicationDocuments commited on
Commit
186d8ec
1 Parent(s): cfd3044

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -70,12 +70,14 @@ def main():
70
  predict_proba = round(torch.softmax(logits, 1).cpu().squeeze().tolist()[prediction],4)
71
  return prediction, predict_proba
72
 
73
- def pred_str(prediction):
74
  # Map the predicted class to string output
75
  if prediction == 0:
76
  return "Human-made 🤷‍♂️🤷‍♀️"
 
 
77
  else:
78
- return "Generated/Revised with AI 🦾"
79
 
80
  @st.cache(allow_output_mutation=True, suppress_st_warning=True)
81
  def load_tokenizer(option):
@@ -157,7 +159,7 @@ def main():
157
 
158
  # Store the result in session state
159
  st.session_state["color_pred"] = "blue" if prediction == 0 else "red"
160
- prediction = pred_str(prediction)
161
  st.session_state["prediction"] = prediction
162
  st.session_state["predict_proba"] = predict_proba
163
  st.session_state["text"] = text
 
70
  predict_proba = round(torch.softmax(logits, 1).cpu().squeeze().tolist()[prediction],4)
71
  return prediction, predict_proba
72
 
73
+ def pred_str(prediction, option):
74
  # Map the predicted class to string output
75
  if prediction == 0:
76
  return "Human-made 🤷‍♂️🤷‍♀️"
77
+ elif prediction == 1 and "Revised" in option:
78
+ return "Revised with AI 🦾"
79
  else:
80
+ return "Generated with AI 🦾"
81
 
82
  @st.cache(allow_output_mutation=True, suppress_st_warning=True)
83
  def load_tokenizer(option):
 
159
 
160
  # Store the result in session state
161
  st.session_state["color_pred"] = "blue" if prediction == 0 else "red"
162
+ prediction = pred_str(prediction, option)
163
  st.session_state["prediction"] = prediction
164
  st.session_state["predict_proba"] = predict_proba
165
  st.session_state["text"] = text