<commit_before>import React, { PropTypes, Component } from 'react'

export default class InputImageComponent extends Component {
  onChangeFileImage(e) {
    var files = e.target.files[0]
    console.log(files)
    var urlObj = URL.createObjectURL(files)
    console.log(urlObj)
    this.props.setImage(urlObj)
  }
  render() {
    const { file } = this.props
    return <div className='ib page'>     
        <img src={file} />
   <p>Выберите изображение</p>
       <input type='file' onChange={::this.onChangeFileImage} />
    </div>
  }
}

InputImageComponent.propTypes = {
  file: PropTypes.object.isRequired
}<commit_msg>Canvas sized by image size<commit_after>import React, { PropTypes, Component } from 'react'
import { Layer, Stage, Image } from 'react-konva';


export default class InputImageComponent extends Component {
  onChangeFileImage(e) {
    var files = e.target.files[0]
    console.log(files)
    var urlObj = URL.createObjectURL(files)
    console.log(urlObj)
    this.props.setImage(urlObj)
  }
 state = {
  image: null,
  width: 0,
  height: 0
}
  componentDidUpdate() {
  const image = new window.Image();
  image.src = this.props.file;
  image.onload = () => {
    this.setState({
      image: image,
      width: image.width,
      height: image.height
    });
  }
}
 
  render() {
    const { file } = this.props
    return <div className='ib page'>
              <Stage width={this.state.width} height={this.state.height}>
                  <Layer>
                    <Image image={this.state.image} />
                  </Layer>
              </Stage>
        <img src={file} />
   <p>Выберите изображение</p>
       <input type='file' onChange={::this.onChangeFileImage} />
    </div>
  }
}

InputImageComponent.propTypes = {
  file: PropTypes.object.isRequired
}
{'fraction_non_alphanumeric': 0.1331476323119777, 'fraction_numerical': 0.0022284122562674096, 'mean_word_length': 2.7261410788381744, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 21, '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': '3296285', 'n_tokens_mistral': 577, 'n_tokens_neox': 578, 'n_words': 122}