From f7dc568f7213c93b3a31ce04342ba1a8f173db70 Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Sun, 27 Aug 2023 20:12:39 +0530 Subject: [PATCH] imgtxt was dumb --- README.md | 1 - cmd/imgtxt.go | 33 --------------------------------- utils/imgtxt.go | 13 ------------- 3 files changed, 47 deletions(-) delete mode 100644 cmd/imgtxt.go delete mode 100644 utils/imgtxt.go diff --git a/README.md b/README.md index c058854..d75338f 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,6 @@ Just `go build` and you're done :D ## Features - An all mode where the responses of all supported engines will be shown. - 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 - A good API (subjective :P) - All the stuff you expect from a translation utility :) diff --git a/cmd/imgtxt.go b/cmd/imgtxt.go deleted file mode 100644 index 346e0db..0000000 --- a/cmd/imgtxt.go +++ /dev/null @@ -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() -} diff --git a/utils/imgtxt.go b/utils/imgtxt.go deleted file mode 100644 index bbbfb7e..0000000 --- a/utils/imgtxt.go +++ /dev/null @@ -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 -}