-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample-esrgan.php
More file actions
38 lines (31 loc) · 1.2 KB
/
example-esrgan.php
File metadata and controls
38 lines (31 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
require __DIR__.'/vendor/autoload.php';
/**
* Configuration
* We need some files (tensorflow itself, and the tensorflow models) to be able
* to use FuncAI. Downloading these files happens automatically, but you need
* to provide folders where we can store those files.
*
* These folders will have to be available on your production server
* and we will store about 300 Mb of data in them.
*/
// Specify where the tensorflow models should be stored
\FuncAI\Config::setModelBasePath(realpath(dirname(__FILE__) . '/models/'));
// Specify where tensorflow should be downloaded to
\FuncAI\Config::setLibPath(dirname(__FILE__) . '/tensorflow/');
/**
* Installation
* This downloads all necessary files and makes sure they are set up correctly.
*/
$tfi = new \FuncAI\Install\TensorflowInstaller();
$tfi->install();
/**
* Prediction
* This is a sample prediction which uses the efficientNet model to determine the contents
* of an image.
*/
$model = new \FuncAI\Models\EsrGAN();
// Remove the comment from the following lines to enable prediction.
// CAREFUL: Using images which are too large will crash your machine.
# $output = $model->predict(__DIR__ . '/sample_data/butterfly.jpg');
# var_dump($output);