Skip to content

Commit

Permalink
update documentation, spring version, script with python beans
Browse files Browse the repository at this point in the history
  • Loading branch information
jeortizquan committed Oct 11, 2024
1 parent 1ff511a commit d788a7f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 17 deletions.
8 changes: 4 additions & 4 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ the application uses a python api to enhance the image

### 1. Image enhancement is possible with the command:
```shell
curl --request POST http://localhost:5050/enhance/image --form image=@./metis-image-enhancer-client/src/test/resources/img/thumbnail.jpg \
curl --request POST http://localhost:8080/enhance/image --form image=@./metis-image-enhancer-client/src/test/resources/img/thumbnail.jpg \
--output ./metis-image-enhancer-client/src/test/resources/img/thumbnail_enhanced.jpg
```
Response:
Expand Down Expand Up @@ -97,7 +97,7 @@ add dependency in your project
By default, the following properties are set in the library if you want to change the address or port, and the timeout
are in seconds.
```
api.url = http://localhost:5050
api.url = http://localhost:8080
connect.timeout = 300
read.timeout = 300
```
Expand All @@ -122,9 +122,9 @@ the /metis-image-enhancer/metis-image-enhancer-demo
```shell
mvn clean package
```
execute the app
execute the app e.g.
```
java -jar ./target/metis-image-enhancer-demo-0.0.1-SNAPSHOT.jar
java -jar ./target/metis-image-enhancer-demo-1-SNAPSHOT.jar
```
example of demo code can be found in the metis-image-enhancer-demo module.

Expand Down
4 changes: 2 additions & 2 deletions metis-image-enhancer-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<artifactId>metis-image-enhancer-client</artifactId>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand Down
6 changes: 4 additions & 2 deletions metis-image-enhancer-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<artifactId>metis-image-enhancer-demo</artifactId>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
Expand Down Expand Up @@ -65,8 +65,10 @@
<!-- We make sure to include files with the build artifacts. -->
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>**/*.png</include>
<include>**/*.properties</include>
</includes>
</resource>
</resources>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ public ImageEnhancerClientConfig getImageEnhancerClientConfig() {
* @param imageEnhancerClientConfig the image enhancer client configuration
* @return the command line runner
*/
// @Bean(name = "apiCommandLineRunner")
// @ConditionalOnProperty(prefix = "worker", name = "service.type", havingValue = "api")
// public CommandLineRunner commandLineRunner(ImageEnhancerClientConfig imageEnhancerClientConfig) {
// return new Runner(imageEnhancerClientConfig);
// }
@Bean(name = "apiCommandLineRunner")
@ConditionalOnProperty(prefix = "worker", name = "service.type", havingValue = "api")
public CommandLineRunner apiCommandLineRunner(ImageEnhancerClientConfig imageEnhancerClientConfig) {
return new Runner(imageEnhancerClientConfig);
}

/**
* Command line runner for script.
Expand All @@ -51,7 +51,7 @@ public ImageEnhancerClientConfig getImageEnhancerClientConfig() {
*/
@Bean(name = "scriptCommandLineRunner")
@ConditionalOnProperty(prefix = "worker", name = "service.type", havingValue = "script", matchIfMissing = true)
public CommandLineRunner commandLineRunner() {
public CommandLineRunner scriptCommandLineRunner() {
return new ScriptRunner( pathToScript);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ isr.connect.timeout = 300
isr.read.timeout = 300
isr.script = ../metis-image-enhancer-python-rest/src/main/mie.py
worker.service.type = script
#worker.service.type = api
2 changes: 1 addition & 1 deletion metis-image-enhancer-python-rest/src/main/mie.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def parameters(argv):
params = dict()

try:
opts = getopt.getopt(argv[1:], "hio:v", ["help", "input=", "output="])
opts, args = getopt.getopt(argv[1:], "hio:v", ["help", "input=", "output="])
except:
print(arg_help)
sys.exit(2)
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@
</modules>
<properties>
<java.version>21</java.version>
<version.spring>2.7.11</version.spring>
<version.junit>5.9.3</version.junit>
<version.mockito>5.4.0</version.mockito>
<version.archunit>1.0.1</version.archunit>
<version.maven.resources.plugin>3.2.0</version.maven.resources.plugin>
<version.maven.compiler.plugin>3.8.1</version.maven.compiler.plugin>
<version.surefire.plugin>2.22.1</version.surefire.plugin>
<version.spring.boot>2.7.14</version.spring.boot>
<version.spring.boot>3.3.4</version.spring.boot>
<version.log4j>2.17.1</version.log4j>
</properties>
<dependencies>
Expand Down

0 comments on commit d788a7f

Please sign in to comment.