Spaces:
Sleeping
Sleeping
jaifar530
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -113,10 +113,7 @@ press_me_button = st.button("Writer or Robot?")
|
|
113 |
if press_me_button:
|
114 |
predicted_author, author_probabilities = predict_author(new_text, loaded_model, tokenizer, label_encoder)
|
115 |
sorted_probabilities = sorted(author_probabilities.items(), key=lambda x: x[1], reverse=True)
|
116 |
-
|
117 |
-
st.write(f"The text is most likely written by: {predicted_author}")
|
118 |
-
st.write("Probabilities for each author are (sorted):")
|
119 |
-
# Mapping the internal names to display names
|
120 |
author_map = {
|
121 |
"googlebard": "Google Bard",
|
122 |
"gpt3": "ChatGPT-3",
|
@@ -125,6 +122,12 @@ if press_me_button:
|
|
125 |
"human": "Human-Written"
|
126 |
}
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
for author, prob in sorted_probabilities:
|
129 |
display_name = author_map.get(author, author) # Retrieve the display name, fall back to original if not found
|
130 |
st.write(f"{display_name}: {prob * 100:.2f}%")
|
|
|
113 |
if press_me_button:
|
114 |
predicted_author, author_probabilities = predict_author(new_text, loaded_model, tokenizer, label_encoder)
|
115 |
sorted_probabilities = sorted(author_probabilities.items(), key=lambda x: x[1], reverse=True)
|
116 |
+
|
|
|
|
|
|
|
117 |
author_map = {
|
118 |
"googlebard": "Google Bard",
|
119 |
"gpt3": "ChatGPT-3",
|
|
|
122 |
"human": "Human-Written"
|
123 |
}
|
124 |
|
125 |
+
predicted_author_diplay_name = author_map.get(predicted_author, predicted_author)
|
126 |
+
st.write(f"The text is most likely written by: {predicted_author_diplay_name}")
|
127 |
+
st.write("Probabilities for each author are (sorted):")
|
128 |
+
# Mapping the internal names to display names
|
129 |
+
|
130 |
+
|
131 |
for author, prob in sorted_probabilities:
|
132 |
display_name = author_map.get(author, author) # Retrieve the display name, fall back to original if not found
|
133 |
st.write(f"{display_name}: {prob * 100:.2f}%")
|