Embedding machine learning models into Android App (Part 2)

This article mainly records Android App accessing websites deployed on Flask.

Mainly divided into the following steps:

1. Write a receiving interface in the App;

The interface is written according to your own needs, so I won’t go into details here.

2. Visit.

My purpose is to click the Button to jump to the web interface to make predictions on the mobile App.

There are two ways for App to access the Web interface: ① through the WebView key; ② through links. (I am using the second one)

Key code:

 Finally, record the problems encountered during this learning process and how to solve them:

①. The App cannot access the web interface deployed on Flask, but it can access other websites, such as Baidu, etc.

Solution: After consulting the information, I initially thought it was because the website I wrote did not have a domain name. So I couldn't access it, so I turned to the domain name to solve the problem. Later, after discussing with others, I found that it should be accessible without a domain name. Because it is accessible on the computer, and since Flask is a server, it should be accessible. Later, I checked the information and set up inbound rules and ports to connect the computer (server) and mobile phone to the same LAN, but found that it still didn't work. Finally, set the host to 0.0.0.0, and connect the computer (server) and mobile phone to the same LAN, and the operation is successful!

 

 

Guess you like

Origin blog.csdn.net/weixin_58222015/article/details/130310991