imgtxt was dumb

This commit is contained in:
Arya 2023-08-27 20:12:39 +05:30
parent d7fc768109
commit f7dc568f72
Signed by: arya
GPG Key ID: 842D12BDA50DF120
3 changed files with 0 additions and 47 deletions

View File

@ -21,7 +21,6 @@ Just `go build` and you're done :D
## Features ## Features
- An all mode where the responses of all supported engines will be shown. - An all mode where the responses of all supported engines will be shown.
- Autodetect which will show the language that was detected - Autodetect which will show the language that was detected
- Tesseract based image recognition (it isn't that good to be fair but it works nontheless)
- Text-To-Speech for multiple engines - Text-To-Speech for multiple engines
- A good API (subjective :P) - A good API (subjective :P)
- All the stuff you expect from a translation utility :) - All the stuff you expect from a translation utility :)

View File

@ -1,33 +0,0 @@
package cmd
import (
"fmt"
"codeberg.org/aryak/mozhi/utils"
"github.com/spf13/cobra"
)
var file string
var imgtxtCmd = &cobra.Command{
Use: "imgtxt",
Short: "Image -> Text.",
Long: `Convert given image (filename) to text using gosseract.`,
Run: func(cmd *cobra.Command, args []string) {
text, err := utils.ImgTxt(file)
if err != nil {
fmt.Println("Failed to convert image to text: ", err)
} else {
fmt.Println(text)
}
},
}
func init() {
rootCmd.AddCommand(imgtxtCmd)
imgtxtCmd.Flags().StringVarP(&file, "file", "f", "", "The query Mozhi will listen to. Defaults to 3000, and overrides the MOZHI_query environment variable.")
langlist = imgtxtCmd.Flag("file").Value.String()
}

View File

@ -1,13 +0,0 @@
package utils
import (
"github.com/otiai10/gosseract/v2"
)
func ImgTxt(file string) (string, error) {
client := gosseract.NewClient()
defer client.Close()
client.SetImage(file)
text, err := client.Text()
return text, err
}