Skip to content

Commit

Permalink
eliminate notion of realness
Browse files Browse the repository at this point in the history
  • Loading branch information
thesofakillers committed Nov 21, 2019
1 parent 45ea562 commit 7f6d815
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 12 deletions.
18 changes: 18 additions & 0 deletions DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Description

(To be used as the long description on the Chrome and Firefox pages)

---

OpenAI's recently released GPT-2 model has revealed itself to be capable of generating incredibly human-like text.

With the rampant spread of fake news and reviews in today's world, such tools may pose a threat to the quality of the information found on the internet.

Luckily, OpenAI also released a detector which is designed to detect whether a given portion of text has been generated by GPT-2 or not.

This extension brings the detector to your browser via a simple browser extension. Simply select a portion of text (at least 50 words) and the extension will determine and display the probability of whether the selected text was generated by GPT-2 or not.

Some notes:

- The detector itself does not run in your browser. The extension makes HTTP requests to https://huggingface.co/openai-detector where the detector is publicly hosted and processes the response, displaying the results in your browser.
- Results should be taken with a grain of salt. The detector is designed specifically to work with GPT-2 generated text. Using a different model or finetuning GPT-2 could be enough to avoid detection. In general, the detector is imperfect. Human-generated text may be marked as GPT-2 generated, and vice-versa.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A browser extension that displays the [GPT-2](https://openai.com/blog/better-language-models/) Log Probability of selected portions of text.

Among the many things that [OpenAI](https://openai.com/)'s GPT-2 model can do, one of these is detecting with certain amount of certainty whether a given portion of text is fake or real. This extension hopes to bring this functionality to your browser (Chrome and Firefox).
Among the many things that [OpenAI](https://openai.com/)'s GPT-2 model can do, one of these is detecting with a certain amount of certainty whether a given portion of text is human-generated. This extension hopes to bring this functionality to your browser (Chrome and Firefox).

Inspired by [this tweet](https://twitter.com/karpathy/status/1192169928079503360?s=20) from [Andrej Karpathy](https://cs.stanford.edu/~karpathy/), the director of AI at [Tesla](https://www.tesla.com/).

Expand Down
8 changes: 4 additions & 4 deletions src/content/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function gotMessage(message) {
}
}

// determines how real a portion of selected text is
// determines how human-like a portion of selected text is
function evaluateSelection() {
// initiate element variable
let element;
Expand Down Expand Up @@ -48,11 +48,11 @@ function evaluateSelection() {
// parse the response from Hugging Face
let all_tokens = json.all_tokens;
let used_tokens = json.used_tokens;
let realness = Math.round(json.real_probability * 100 * 100) / 100;
let css_color_string = generateHSLString(realness, 0, 120);
let human_likeness = Math.round(json.real_probability * 100 * 100) / 100;
let css_color_string = generateHSLString(human_likeness, 0, 120);

// prepare the message
let message_text = `According to the detector, there is a ${realness} % chance that the selected text is real. ${used_tokens} out of ${all_tokens} tokens were considered`;
let message_text = `According to the detector, there is a ${human_likeness} % chance that the selected text written by a human. ${used_tokens} out of ${all_tokens} tokens were considered.`;
// update the message element with the outcome
message_element.text(message_text);
message_element.css("border", `2px dashed ${css_color_string}`);
Expand Down
4 changes: 2 additions & 2 deletions src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"manifest_version": 2,
"name": "GPTrue or False",
"version": "3.0.1",
"description": "Display OpenAI's GPT-2 log probability of a sample of text.",
"version": "3.0.2",
"description": "Display the likelihood that a sample of text was generated by OpenAI's GPT-2 model.",
"icons": {
"16": "./images/icon/16.png",
"32": "./images/icon/32.png",
Expand Down
9 changes: 5 additions & 4 deletions src/popup/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@
<div class="main m-5 p-4">
<h1>GPTrue or False</h1>
<p>
Display OpenAI's GPT-2 log probability of a sample of text. Is the given
text falsely generated?
Let OpenAI's GPT-2 detector evaluate a sample of text. Is the given text
computer generated?
</p>
<div class="selectedText">
<h4>Determine realness of selected text</h4>
<h4>Evaluate a text selection</h4>
<p>
Select at least 50 words from the current page and press the button
below to determine the realness of the selected text.
below to determine the how likely it is that the selected text was
written by a human.
</p>
<div class="col text-center">
<button
Expand Down
2 changes: 1 addition & 1 deletion src/popup/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ document.getElementById("evaluateSelectedText").onclick = () => {
function activateButton(button_id) {
let button = document.getElementById(button_id);
button.disabled = false;
button.innerText = "Determine Realness!";
button.innerText = "Evaluate!";
button.className = "btn btn-success";
}

Expand Down

0 comments on commit 7f6d815

Please sign in to comment.