Skip to content

Instantly share code, notes, and snippets.

@drdaxxy
Created September 5, 2020 04:13
Show Gist options
  • Save drdaxxy/5dfc56a794ee76ca0d21539bee409f64 to your computer and use it in GitHub Desktop.
Save drdaxxy/5dfc56a794ee76ca0d21539bee409f64 to your computer and use it in GitHub Desktop.
gpt-3 generated dril tweets but for any keyword you want
/* yolo */
.App {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
form {
margin-top: 20px;
margin-bottom: 20px;
}
input {
font-size: x-large;
margin-left: 10px;
}
// $ yarn create react-app dril && cd dril
// $ yarn add moment fake-tweet
// insert openai api key below
// throw this App.js and App.css into dril/src
// $ yarn start
import React, { useState } from 'react';
import FakeTweet from "fake-tweet";
import moment from "moment";
import "fake-tweet/build/index.css";
import './App.css';
const OPENAI_API_KEY = 'FILL THIS IN';
function App() {
const template = (query) => `query date username tweet
"cum" 05/07/2020 dril inventing a new type of cum by jacking off incorrectly
"simpsons" 02/09/2019 dril local church replaced with "The Simpsons lounge" where you can watch any episode of THe Simpsons & buy themed drinks based on the characters
"academic" 03/10/2015 dril oh, youvve read a few academic papers on the matter? cute. i have read over 100000 posts.
"sydney" 18/09/2019 dril nice sydney opera house you got here. would be a shame it if were to become the the sydney Gamer house...
"driving" 01/08/2019 dril driving down the highway at 30mph laying on the horn protecting myself with a shield of Noise
"flintstone" 25/10/2019 dril fred flintstone does not Jack off ever, he works hard every day to provide for his family, fuck you for saying something like that
"book" 20/08/2019 dril writing a massive 350 page book about my twiiter brand that no one will read, is, in a lot of ways, like being a Prisoner of War
"smoke" 29/08/2019 dril you say you smoke two packs a day? two packs of what, pal? shit?
"screaming" 10/03/2018 dril go ahead. keep screaming "Shut The Fuck Up " at me. it only makes my opinions Worse
"food" 03/10/2020 dril Waiters do not put the big silver dome over our food before serving it anymore because of politics culture
"gamer" 25/07/2020 dril one thing the gamer world is certainly agreeing of, is that halo infinite is sure to be the highest numbered halo game yet
"${query}" 04/09/2020 dril `;
const [text, setText] = useState("");
const [date, setDate] = useState("");
const [retweets, setRetweets] = useState(0);
const [likes, setLikes] = useState(0);
const [subject, setSubject] = useState("");
const handleSubmit = (e) => {
fetch("https://api.openai.com/v1/engines/davinci/completions", {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${OPENAI_API_KEY}`
},
body: JSON.stringify({
max_tokens: 300,
frequency_penalty: 0.2,
temperature: 0.8,
prompt: template(subject),
stop: "\n"
})
})
.then(response => response.json())
.then(data => {
setText(data.choices[0].text);
setDate(moment().format("h:mm a · D MMM YYYY"));
setLikes(Math.floor(Math.random() * 60000));
setRetweets(Math.floor(Math.random() * 60000));
});
e.preventDefault();
};
return (
<div className="App">
<form onSubmit={handleSubmit}>
<input type="text" value={subject} onChange={e => setSubject(e.target.value)} />
<input type="submit" value="Submit" />
</form>
<FakeTweet config={
{
user: {
nickname: "dril",
name: "wint",
avatar: "https://pbs.twimg.com/profile_images/847818629840228354/VXyQHfn0_400x400.jpg",
},
text: text,
date: date,
app: "Twitter Web App",
retweets: retweets,
likes: likes
}
} />
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment