lele
lele

Reputation: 103

How to link flutter with Google Cloud API written in python

I implemented the speech to text function using python. I used google cloud api as speech to text api. My ultimate goal is to develop an application with speech to text functionality with flutter. I want to load speech to text implemented in python into flutter and put it in the application. How can I do this?

I use a translator so the sentences may be awkward.

This photo is a test of the speech to text function implemented in python.

Upvotes: 0

Views: 118

Answers (1)

DazWilkin
DazWilkin

Reputation: 40071

Your question is quite broad and is challenging to answer succinctly.

IIUC you want to combine a Flutter (framework) app (written in Dart) with a Python app.

It is probably not a good idea to put it in the application.

The Dart app runs in one process and the Python app runs in another process. It is possible to create a process (e.g. for your Python app) in Dart (using Process class) but I advise against this.

If the Python app comprises standalone functionality, one option if you really don't wish to rewrite the Python functionality, is to run the Python app as a server and communicate with it from the Dart app. There are many ways this could be done including using e.g. gRPC.

However, I think the best solution would be for you to rewrite the Python app in Dart and combine the functionality into a single Flutter app.

Google provides a Dart SDK for Cloud Speech-to-Text API. IIUC, there aren't (Google-provided) Cloud Client Libraries available in Dart (list). I assume (!?) that you used the Python SDK for Cloud Speech-to-Text API and so the conversion to Dart should be relatively straightforward.

Upvotes: 1

Related Questions