<commit_before>import requests, json
import urllib3
urllib3.disable_warnings()

import config as config

class Glower(object):
	sid 					= None
	token 					= None
	
	params					= {}
	config					= config

	def __init__(self, _sid, _token, **kwargs):	
		setattr(self, 'sid', _sid)
		setattr(self, 'token', _token)
				
		for key, val in kwargs.iteritems():
			self.params[key] = val
		
	def use(self, set_name="default"):
		self.set_name = set_name
		
	def train(self, data_set, response):
		data = {
			"data_set": data_set,
			"response": response
		}
		return self._request('train', data)
		
	def train_csv(self, data_set, response):
		files = {
			"data_set": open(data_set, 'rb') if isinstance(data_set, (str, unicode)) else data_set,
			"response": open(response, 'rb') if isinstance(response, (str, unicode)) else response
		}
		return self._request('train/csv', {}, files)
		
	def predict(self, data_set, response=None):
		data = {
			"data_set": data_set,
			"response": response
		}
		return self._request('predict', data)
		
	def predict_csv(self, data_set, response=None):
		files = {
			"data_set": open(data_set, 'rb') if isinstance(data_set, (str, unicode)) else data_set,
			"response": open(response, 'rb') if isinstance(response, (str, unicode)) else response
		}
		return self._request('predict/csv', {}, files)
		
	def cluster(self, data_set):
		data = {
			"data_set": data_set
		}
		return self._request('cluster', data)
		
	def cluster_csv(self, data_set):
		files = {<commit_msg>Fixed no response in predict.<commit_after>import requests, json
import urllib3
urllib3.disable_warnings()

import config as config

class Glower(object):
	sid 					= None
	token 					= None
	
	params					= {}
	config					= config

	def __init__(self, _sid, _token, **kwargs):	
		setattr(self, 'sid', _sid)
		setattr(self, 'token', _token)
				
		for key, val in kwargs.iteritems():
			self.params[key] = val
		
	def use(self, set_name="default"):
		self.set_name = set_name
		
	def train(self, data_set, response):
		data = {
			"data_set": data_set,
			"response": response
		}
		return self._request('train', data)
		
	def train_csv(self, data_set, response):
		files = {
			"data_set": open(data_set, 'rb') if isinstance(data_set, (str, unicode)) else data_set,
			"response": open(response, 'rb') if isinstance(response, (str, unicode)) else response
		}
		return self._request('train/csv', {}, files)
		
	def predict(self, data_set, response=None):
		data = {
			"data_set": data_set,
			"response": response
		}
		return self._request('predict', data)
		
	def predict_csv(self, data_set, response=None):
		files = {
			"data_set": open(data_set, 'rb') if isinstance(data_set, (str, unicode)) else data_set
		}
		
		if response:
			files['response'] = open(response, 'rb') if isinstance(response, (str, unicode)) else response
		
		return self._request('predict/csv', {}, files)
		
	def cluster(self, data_set):
		data = {
			"data_set": data_set
		}
		return self._request('cluster', data)
		
	def cluster_csv(self, data_set):
		files = {
{'fraction_non_alphanumeric': 0.14149704530531845, 'fraction_numerical': 0.0013131976362442547, 'mean_word_length': 3.9544715447154473, 'pattern_counts': {'":': 17, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1241457', 'n_tokens_mistral': 1210, 'n_tokens_neox': 1052, 'n_words': 268}