Skip to content

ruibty/open-nsfw-spring-boot-starter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

open-nsfw-spring-boot-starter

本地内置训练好的模型,结果以不大于1的小数表示其内容的不安全可能性。

结果受限于模型和技术原理,不能保证百分百的准确性。

base

使用

  1. pom.xml
<!-- https://mvnrepository.com/artifact/com.ruibty.nsfw/open-nsfw-spring-boot-starter -->
<dependency>
    <groupId>com.ruibty.nsfw</groupId>
    <artifactId>open-nsfw-spring-boot-starter</artifactId>
    <version>1.0</version>
</dependency>
  1. eg.
@RestController
@SpringBootApplication
public class DemoApplication {
    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }

    @Autowired
    private NsfwService nsfwService;

    @PostMapping
    public ResponseEntity<BigDecimal> upload(
            @RequestParam("file") MultipartFile multipartFile
    ) throws IOException {
        byte[] imgBytes = multipartFile.getBytes();
        float prediction = nsfwService.getPrediction(imgBytes);
        BigDecimal result = new BigDecimal(String.valueOf(prediction));
        return ResponseEntity.ok(result);
    }
}

联系方式

如果有bug、讨论、新功能建议等等,欢迎你找到我:

  • 邮箱
ruibty@qq.com

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages