ankush29 commited on
Commit
2f00951
Β·
1 Parent(s): f656f94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -8
app.py CHANGED
@@ -69,9 +69,9 @@ def analyze_text(sentence):
69
  if total_valid_char < 200:
70
  results["Label"] = -1
71
  results["Output"] = "Insufficient Content"
72
- results["Percent_ai"] = ""
73
- results["Perplexity"] = ""
74
- results["Burstiness"] = ""
75
 
76
  return results
77
 
@@ -88,7 +88,7 @@ def analyze_text(sentence):
88
  if perplexity < ai_perplexity_threshold:
89
  ai_characters += len(line)
90
 
91
- results["Percent_ai"] = round((ai_characters/total_characters)*100,2)
92
  results["Perplexity"] = round(sum(perplexities) / len(perplexities),2)
93
  results["Burstiness"] = round(max(perplexities),2)
94
 
@@ -135,7 +135,7 @@ def main():
135
  st.title("CheckGPT")
136
  st.write("CheckGPT is an AI-powered text analysis tool that predicts the content generated by AI by evaluating the perplexity and burstiness scores of GPT model, and provides insights for investigating text authenticity.")
137
  st.write("This app is hosted on the free tier of HuggingFace Scapes, resulting in slow performance 🐒. Check out the GitHub repo to quickly run the app on your device and to enjoy a much faster experience! πŸš€πŸš€")
138
- st.write("Check out the app on GitHub <a href='https://github.com/Ank-Cha/CheckGPT' target='_blank'><img src='https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png' alt='GitHub Logo' width='30' height='30'></a>", unsafe_allow_html=True)
139
  st.write("Feel free to explore and star ⭐️ the repo if you find it helpful!")
140
 
141
  # Create an empty placeholder for the uploaded files
@@ -183,9 +183,7 @@ def main():
183
  if results_list:
184
  df = pd.DataFrame(results_list)
185
  df = df[["file_name", "Percent_ai", "Perplexity", "Burstiness", "Output"]]
186
- df["Percent_ai"] = df["Percent_ai"].astype(str)
187
- df["Perplexity"] = df["Perplexity"].astype(str)
188
- df["Burstiness"] = df["Burstiness"].astype(str)
189
  df = df.rename(columns={"Percent_ai": "Predicted AI percent", "Perplexity": "Perplexity Score", "Output": "Predicted Output"})
190
  st.write("Results:")
191
 
 
69
  if total_valid_char < 200:
70
  results["Label"] = -1
71
  results["Output"] = "Insufficient Content"
72
+ results["Percent_ai"] = "-"
73
+ results["Perplexity"] = "-"
74
+ results["Burstiness"] = "-"
75
 
76
  return results
77
 
 
88
  if perplexity < ai_perplexity_threshold:
89
  ai_characters += len(line)
90
 
91
+ results["Percent_ai"] = str(round((ai_characters/total_characters)*100,2))+"%"
92
  results["Perplexity"] = round(sum(perplexities) / len(perplexities),2)
93
  results["Burstiness"] = round(max(perplexities),2)
94
 
 
135
  st.title("CheckGPT")
136
  st.write("CheckGPT is an AI-powered text analysis tool that predicts the content generated by AI by evaluating the perplexity and burstiness scores of GPT model, and provides insights for investigating text authenticity.")
137
  st.write("This app is hosted on the free tier of HuggingFace Scapes, resulting in slow performance 🐒. Check out the GitHub repo to quickly run the app on your device and to enjoy a much faster experience! πŸš€πŸš€")
138
+ st.write("Checkout the code on GitHub <a href='https://github.com/Ank-Cha/CheckGPT' target='_blank'><img src='https://cdn-icons-png.flaticon.com/512/536/536452.png' alt='GitHub Logo' width='25' height='25' style='margin-left: 5px;'></a>", unsafe_allow_html=True)
139
  st.write("Feel free to explore and star ⭐️ the repo if you find it helpful!")
140
 
141
  # Create an empty placeholder for the uploaded files
 
183
  if results_list:
184
  df = pd.DataFrame(results_list)
185
  df = df[["file_name", "Percent_ai", "Perplexity", "Burstiness", "Output"]]
186
+ df = df.astype(str)
 
 
187
  df = df.rename(columns={"Percent_ai": "Predicted AI percent", "Perplexity": "Perplexity Score", "Output": "Predicted Output"})
188
  st.write("Results:")
189