This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UploadPage extends StatefulWidget { | |
UploadPage({Key key, this.url}) : super(key: key); | |
final String url; | |
@override | |
_UploadPageState createState() => _UploadPageState(); | |
} | |
class _UploadPageState extends State<UploadPage> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:image_picker/image_picker.dart'; | |
import 'package:http/http.dart' as http; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(String filename, String url) async { | |
var request = http.MultipartRequest('POST', Uri.parse(url)); | |
request.files.add( | |
await http.MultipartFile.fromPath( | |
'picture', | |
filename | |
) | |
); | |
var res = await request.send(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(String filename, String url) async { | |
var request = http.MultipartRequest('POST', Uri.parse(url)); | |
request.files.add( | |
http.MultipartFile.fromBytes( | |
'picture', | |
File(filename).readAsBytesSync(), | |
filename: filename.split("/").last | |
) | |
); | |
var res = await request.send(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(String filename, String url) async { | |
var request = http.MultipartRequest('POST', Uri.parse(url)); | |
request.files.add( | |
http.MultipartFile( | |
'picture', | |
File(filename).readAsBytes().asStream(), | |
File(filename).lengthSync(), | |
filename: filename.split("/").last | |
) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import actions | |
parser = argparse.ArgumentParser( | |
description="Improve the way you look at your picture collection with this simple CLI tool" | |
) | |
subparsers = parser.add_subparsers() | |
generate = subparser.add_parser("generate", help="Generate the pictures") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from imageprocessor import ImageProcessor | |
def process_dir(args): | |
""" | |
Process the images: copy them so that | |
you can recognize what directory | |
they came from both from their name | |
and from the text annotated over them. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from wand.image import Image | |
from wand.drawing import Drawing | |
import os | |
from sys import argv | |
from shutil import copyfile | |
class ImageProcessor: | |
""" | |
The interface between our tool and | |
the Wand library |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onPressed: () async { | |
var imgFile = await ImagePicker.pickImage( | |
source: ImageSource.camera | |
); | |
setState((){ | |
imgs.add(Image.file(imgFile)); | |
}); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PictureShowcaseHome extends StatefulWidget { | |
final String title; | |
PictureShowcaseHome(this.title); | |
_HomePageState createState() => _HomePageState(); | |
} | |