I have image processing application written in python consists of CRNN model, and I want to take an image from my android application and send it to the image processing and receive back a response from it.
what should I use to make it done.
I would create a server that deals with the logic (in python) and make the app communicate with it over HTTP requests.
The app would send the image to the server, the server would process it, and then send the output to the app.
Related
Here is what I've done so far: There is an API (Hacker News - https://github.com/HackerNews/API) from which I send a GET request from my Java program and retrieve the data. I am able to parse the (JSON) data so that it can be manipulated by the JDK.
Here is what am trying to do next: I want to have my Java program/server communicate with my React application so that React can retrieve the parsed JSON data and display it on a webpage.
Confusion: How do I have React get the data? Do I set it up so that it sends a GET request from my Java server? I have consulted more tutorials than I can count, but I am simply not understanding how to do it.
My code can be found here https://github.com/EmekaEnshinyan/HackerNews-API-Design-Back-End
Your React application is the frontend, and the Java program is the backend, in which case you would send a GET request from React to the Java program using clients like Axios or the built-in fetch.
The Java program will need to be served on a server or local development server to receive, handle that request, and send a JSON response back to React. You can take a look at creating a RESTful API in Java.
I am coming from java based web application background where client is thin client i.e. browser and all UI pages(HTML,CSS,JS) along with
data comes from server. But with recent read on net about android based mobile apps and based on Q/A on stack overflow came with this understanding
Android app with backend(where data is fetched from server) is like two application communicating with each other on http. When I say two app , these
are one on mobile which is java(android) application and second is on server which is generally exposed through web services which can be in any language
like java/dot net. Is it correct ?
If yes I have one doubt when comparing it with java server based web app This is in regard of where UI pages . In web application,
UI views are returned from server in the forms of HTML. But I am confused where UI pages resides in android app. Is it generally on client side(all ui pages
are downloaded with app . With different events app serves the UI from client side itself but data comes from server) or they are served from server ?
If from server are they served again as HTML or there is some other format that android better gels with ?
May be android app generally should not expect any UI pages from server which means downloaded app should have all UI pages with it.
I think the UI is still on the client while the content for filling of the UI is from the server. This content is transported in HTTP(s) protocol, therefore in HTML format as you said. But one can use other protocols to get the response from the server I guess.
I am developing android chatbot application using program-o. I have program-o running on my localhost. I went through program-o documentation but still, I'm not able to understand what changes I need make to enable the communication between my Android app and program-o server.
Write a php code to use program-o api.
Take the chat input from GET/POST parameters.
Use that input to get the output from program-o.
Parse that into json or any other format you like and print it.
Host that php file on a web server.
Now make an HTTP connection from android app. Give the input as parameters and parse the output received.
You have to create a LAMP server and run an instance of Program o
Json / xml rest api will interface will android app
You must use async task runner,httpresponse , and all.
I am trying to developer an Android application which allows to capture pictures with the camera, and send the pictures to a Java server.
I don't need the picture after, so I do not need to store it in the phone locally.
I was able to successfully to transfer simple text from client to server, but I'm having problems with images.
What do I need to do to be able to send images from the Android client, and should anything special be made in the server apart from what it is doing now?
Solution is to use http request with MultipartEntity.
I have a java application that will take the image as an input and output another image. I have a website with a popular host (PHP+MYSQL Hosting). I want to create a page on the website with PHP with a form where a user can upload an image which will then pass the image onto the Java application.
What I am planning on doing is when then user uploads the image, it gets stored in a folder on the web server. I will then call the java app on the server passing the url of the image as an argument and then the java app will output another image, let’s say, to a result folder. The PHP page after the execution will then display the result image on the browser.
Now my questions are:
Is it possible to execute java apps on popular webhosts (for example mine is WebHostingBuzz.com)?
The java app is fairly heavy as it does a lot of image processing. Should I offload the java app to another web server? If yes, are there any services that will run my java app?
(Optional) It’s a demo of my java app and I don’t want to store the images people upload. Is there a way where I can directly pass the uploaded image to the java app and output the image generated directly instead of storing it on the web server? I would prefer this because, if the image is big, I can make PHP stop the execution after a timeout.
How do I communicate with the java app from PHP for info on its execution, for example When PHP calls the java app, the page has to wait till the app finishes processing? I want the java app to send a response to the PHP page saying that the processing is completed and the page is redirected or refreshed accordingly.
I hope you get the idea, please suggest the technologies that I can use to implement this and also if you have a better idea, post it!
Thanks!
Now my questions are: Is it possible to execute java apps on popular webhosts (for example mine is WebHostingBuzz.com)?
It's technically possible. But the hosting has to install JRE at the host and give the PHP user sufficient OS-level and filesystem-level permissions. So you're really dependent on the hosting whether they provide this opportunity. Best is to just contact their support team and ask it.
If it is supported, you could just use shell_exec().
$result = shell_exec("java -jar /path/to/imageprocessor.jar " + $imagepath);
if ($result) {
// Shell execution succeed.
} else {
// Shell execution failed.
}
For asynchronous communication / background processing, the client has to fire an ajaxical request.
If it is not supported, consider porting Java to PHP. The GD image library has pretty a lot of functions which may be of use.
Google App Engine allows to host Java (and Python) web applications. The SDK and the basic account is free of charges. With the SDK, you could develop and test the application locally and then simply deploy to App Engine (NetBeans and Eclipse plugins are available).
Then the PHP app could send the data in a HTTP POST to the Google App Engine application and get the result in the response data.
Or the data is stored first in a database blob and a processing job is put in a task queue (a 'message queue'). This has the advantage that the PHP client request will return immediately after the data has been POSTed. Then, the PHP application could poll for the result data while Google App Engine processes the image. The PHP side would be more responsive this way.
Wouldn't it be easier to make your java app a web app, that PHP could call via an url in wich he would put the url of the image so java can download it?
like http://yourjavaserver/imageprocessing?imgurl=IMAGE_URL
and the java servlet would reply with the image file itlsef.
You can look for "java hosting" on google, to find a host for this, but it's more expensive than PHP hosting. Maybe the best choice would be to get a dedicated server which could host both PHP and java applications...
I think your best bet here is with your java app running as cron(or a deamon) that can load the file details from the database. This will require a (one or more) page-refresh on the users part after the generation is complete, at which point your script can recall the image from the database/filesystem.
I do not think you will be able to do this in real-time due to timeout restrictions on the PHP webpage. However, you could write a java applet that can take the file and process it before sending it to the server (or depending on how you intend to use it, perhaps you do not need to upload it after the transformation?).