View Code Snippet
**The following is the system prompt given to ChatGPT:**
Role: AI content filter.
Task: Evaluate social media posts using provided filters.
Input:
- JSON with 'filters' and 'textItems'.
- 'filters' includes 'custom' (active filters) and 'defaults' (categories like "politics").
- 'textItems' are posts to be evaluated with 'id' and 'text'.
- 'config' holds 'filterStrength' (1-10).
Output:
- Array of {'id', 'hide', 'reason'}.
- 'id' matches text item's id.
- 'reason' explains decision (<10 words).
- 'hide' is boolean: filter out (true) or not (false).
- Encase array in "--[" and "]--".
Note: Unflagged items are allowed.
Example:
User JSON:
{
"filterConfig": {
"filters": {
"custom": [{"active": true, "text": "no dogs"}],
"defaults": ["politics", "spam"]
},
"strength": 3
},
"textItems": [
{"id": "id_1", "text": "I love dogs"},
...
],
"config": {"filterStrength": 3}
}
Output:
"--[
{"id": "id_1", "hide": true, "reason": "text mentions dogs"},
...
]--
View Code Snippet
class rnn_model(nn.Module):
def __init__(self, input_size, n_hidden, n_layers, n_out):
super().__init__()
self.n_hidden=n_hidden
self.n_layers = n_layers
self.lstm = nn.LSTM(input_size, n_hidden, n_layers, batch_first = True, dropout = 0.3)
self.fcn1 = nn.Linear(n_hidden, 128)
self.fcn2 = nn.Linear(128, n_out)#single value for regression
self.dropout = nn.Dropout(0.2)
def forward(self, x, hidden):
#x input shape is (batch_size, seq_len, features)
lstm_out, hidden = self.lstm(x)
lstm_out = lstm_out.contiguous().view(-1,self.n_hidden) #reshape lstm output for fcl
output=self.fcn1(lstm_out)
output = self.dropout(output)
output=self.fcn2(output)
#sig_out = self.sig(output)
#print(x.size(0))
output = output.view(x.size(0),-1)
return output[:,-1], hidden #return last prediction for each batch, and the hidden state
def init_hidden(self,batch_size):
weight = next(self.parameters()).data
if (train_on_gpu):
hidden = (weight.new(self.n_layers, batch_size, self.n_hidden).zero_().cuda(),
weight.new(self.n_layers, batch_size, self.n_hidden).zero_().cuda())
else:
hidden = (weight.new(self.n_layers, batch_size, self.n_hidden).zero_(),
weight.new(self.n_layers, batch_size, self.n_hidden).zero_())
return hidden
rnn = rnn_model(1,64,2,1)
rnn
View Code Snippet
@staticmethod
def poolFunction(seed):
ch.setCoin(cf.COIN)
ch.setEncoder(cf.ENCODER)
ch.setHasher(cf.HASHER)
pkey = ch.getHash(seed)
addy = ch.getAddress(pkey, address_type=cf.BTC_ADDRESS_TYPE)
seed = seed.replace(',', 'CMA')
return f'{seed} ,{pkey},{addy}'
def generateAddressText(self, seeds):
# stop here
addressList = [line for line in self.map(
self.poolFunction, seeds, chunksize=self.chunksize)]
addressString = ''.join(addressList)
return addressString