93
submitted 9 months ago by Artemis_Mystique@lemmy.ml to c/linux@lemmy.ml

With modern CPU's supposedly shipping with 'AI cores': How long do you think it will take for a proper opensource, privacy respecting productivity tools(Something like whatever M$ copilot is supposed to be?) to be available?

Personally, i would love to see something like 'Passive' OCR integrated with the display server: the ability to pause any video and just select whatever text(even handwritten) there is naturally like it was a text document without any additional hassle will be really useful
Also useful in circumventing any blocks certain websites put on articles to prevent text from being copied

Or an AI grammar checker running natively for LibreOffice.

What are some AI tools you think should be developed for desktop Linux?

top 24 comments
sorted by: hot top controversial new old
[-] savvywolf@pawb.social 27 points 9 months ago

Hasn't OCR been around for ages now, and doesn't need dedicated hardware? I think the main limitation is putting the infrastructure in place to allow a browser to speak to an accessibility tool (because this is an accessibility issue) and say "give me all the text on screen which is embedded in images".

Personally, I don't really want any AI tools. I don't want my system trying to preempt what I want to do and half arse it, when I could always just do it myself. I want to know exactly what my system is doing and not have it "helpfully" do or change things it thinks I might want it to.

[-] Artemis_Mystique@lemmy.ml 15 points 9 months ago

I was thinking more along the lines of something that is application agnostic i.e If it is on your display, the tool can grab it

[-] qaz@lemmy.world 3 points 9 months ago* (last edited 9 months ago)

I personally have a script that allows me to press a keybinding and then select some part of the display after which it copies the contents to my clipboard as text. Are you looking for something like that?

Here it is, it should work on both Wayland and X11, but does require having spectacle and tesseract installed.

#!/bin/bash

# Written by u/qaz licensed under GPL3

if ! which spectacle > /dev/null; then
    kdialog --sorry "spectacle, the required screenshotting tool, is not installed."
    exit 1
fi

if ! which tesseract > /dev/null; then
    kdialog --sorry "tesseract, the required OCR package, is not installed."
    exit 1
fi

screenshot_tempfile=$(mktemp)
spectacle -brn -o $screenshot_tempfile
text_tempfile=$(mktemp)
tesseract $screenshot_tempfile $text_tempfile
rm $screenshot_tempfile

result_text=$(cat $text_tempfile.txt)
rm $text_tempfile.txt

# Copy to either X11 or Wayland clipboard
echo $result_text | xclip -selection clipboard
wl-copy "$result_text"

notify-send -u low -t 2500 "Copied text to clipboard" "$result_text"
[-] 0x0@social.rocketsfall.net 16 points 9 months ago
[-] TheEntity@kbin.social 15 points 9 months ago

You can already use Tesseract to run OCR on any image. It's a matter of tying it together with a screenshot tool with cropping capabilities and it should be very easy to use.

[-] utopiah@lemmy.ml 6 points 9 months ago

I've done a bash script and a KDE shortcut for that a while ago. I didn't even remember it until now. It's useful sometimes.

[-] utopiah@lemmy.ml 9 points 9 months ago* (last edited 9 months ago)

FWIW :

fabien@fabien-CORSAIR-ONE-i160:~$ cat /home/fabien/bin/screenocr #!/bin/bash

spectacle -r -nb -o /tmp/test.png
tesseract -l eng /tmp/test.png /tmp/ocr
#date +%s >> ~/grab_timed
#cat /tmp/ocr.txt >> ~/grab_timed
firefox --new-tab --url https://duckduckgo.com/?q="$(cat /tmp/ocr.txt)"

PS: was curious about it, done that in August 2022

[-] utopiah@lemmy.ml 10 points 9 months ago

Like... now? Here are my notes about it https://fabien.benetou.fr/Content/SelfHostingArtificialIntelligence

You don't even need to wait for "AI" chips, "just" a high-end GPU will do.

Sure they are very very large models like Mistral or BLOOM you won't be able to run even on a 4090 (highest end gaming card right now) but there usually have lower quality versions that might give usable result.

IMHO though what I realized while testing all that at home is... it's rarely worth it. It's absolutely fun to play with, even interesting to learn about it all, but in terms of time/energy/ecology/costs versus result, so far it's been "meh". A cool experiment, like locally get transcript for my PeerTube server from the audio of my videos, but something that in fine I always end up not relying on.

It also allows me to do cool prototype, like code generation in XR, but again that's something I'd qualify as fun, not as productive.

TL;DR: it's feasible today but IMHO not worth it.

PS: best example would be Immich with it's optional ML, locally or not (as in serving content on a small Pi but doing the ML inference on your desktop)

[-] Artemis_Mystique@lemmy.ml 3 points 9 months ago

you don’t even need to wait for “AI” chips, “just” a high-end GPU will do

Not everyone wants or can afford an expensive GPU, meanwhile the new AMD 8000G series looks highly compelling and I was just curious whether there are any roadmaps to productively incorporate their use on the Linux desktop in a similar way to what M$ is pushing with co-pilot(Obviously without the corporate surveillance)

If your Cool AI tool requires me to always connect to the internet and agree to a concerning EULA and privacy policies; i think i can live without it

[-] savvywolf@pawb.social 2 points 9 months ago

If I were AMD or Intel I'd absolutely reserve the fancy new buzzword tech for only the highest spec cpus in order to give people a reason to overspend.

I expect only decently high end cpus would have this fancy "AI" tech.

[-] Atemu@lemmy.ml 1 points 9 months ago

You don't even need to wait for "AI" chips, "just" a high-end GPU will do.

You don't even need that. A decently high-end CPU will also work, just a good bit slower of course.

[-] vintageballs@feddit.de 1 points 9 months ago

Mistral can be easily run on a 4090. I think you mean Mixtral.

[-] sbv@sh.itjust.works 8 points 9 months ago

Android's task switcher does this, and it's amazing. I find myself using it all the time.

Meanwhile, OSX has something similar, but it involves more work, so I can't be bothered.

[-] 2xsaiko@discuss.tchncs.de 5 points 9 months ago

Meanwhile, OSX has something similar, but it involves more work, so I can’t be bothered.

If the application behaves, you can directly select text in images. Preview does it, Safari does it (in videos too), Photos does it, the window that comes up after you take a screenshot does it (I guess that's closest to what Android does, in which way is it more work?), to name a few. I'd love this to become a standard on Linux, it's so very useful.

[-] vintageballs@feddit.de 5 points 9 months ago

An all-encompassing assistant will probably be a ways off. But LLM-based tools that can process visual inputs are already available to the general customer, e.g. LLava.

[-] thevoidzero@lemmy.world 3 points 9 months ago* (last edited 9 months ago)

Not for handwritten text, but for printed fonts, getting OCR is as easy as just making a box in screen with current technology. So I don't think we need AI things for that.

Personally I use tesseract. I have a simple bash script that when run let's me select a rectangle in screen, save that image and run OCR in a temp folder and copy that text to clipboard. Done.

Edit: for extra flavor you can also use notify-send to send that text over a notification so you know what the OCR produced without having to paste it.

[-] aBundleOfFerrets@sh.itjust.works 2 points 9 months ago

Share the script! Share the script! Share the script! (Nobody will judge you if it is written strangely or is hard to adapt, reading other people’s code is always fun (bash scripts are code fight me))

[-] thevoidzero@lemmy.world 1 points 9 months ago

Hi there, I did say it's easily doable, but I didn't have a script because I run things based on the image before OCR manually (like the negating the dark mode I tried in this script; when doing manually it's just one command as I know whether it's dark mode of not myself; similar for the threshold as well).

But here's a one I made for you:

#!/usr/bin/env bash

# imagemagic has a cute little command for importing screen into a file
import -colorspace gray /tmp/screenshot.png
mogrify /tmp/screenshot.png -color-threshold "100-200"
# extra magic to invert if the average pixel is dark
details=`convert /tmp/screenshot.png -resize 1x1 txt:-`
total=`echo $details | awk -F, '{print $4}'`
value=`echo $details | awk '{print $7}'`
darkness=$(( ${value#_(%_)} * 100 / $total ))
if (( $darkness < 50 )); then
   mogrify -negate /tmp/screenshot.png
fi

# now run the OCR
text=`tesseract /tmp/screenshot.png -`
echo $text | xclip -selection c
notify-send OCR-Screen "$text"

So the middle part is to accommodate images in dark mode. It negates it based on the threshold that you can change. Without that, you can just have import for screen capture, tesseract for running OCR. and optionally pipe it to xclip for clipboard or notify-send for notification.

In my use case, I have keybind to take a screenshot like this: import png:- | xclip -selection c -t image/png which gives me the cursor to select part of the screen and copies that to clipboard. I can save that as an image (through another bash script), or paste it directly to messenger applications. And when I need to do OCR, I just run tesseract in the terminal and copy the text from there.

[-] bionicjoey@lemmy.ca 2 points 9 months ago

AI chips are optimized for running large models right? They aren't needed to do simple stuff if you have a decent CPU/GPU.

you can use kobold AI with a model meant for programming, no?

[-] rufus@discuss.tchncs.de 1 points 9 months ago* (last edited 9 months ago)

https://github.com/ggerganov/llama.cpp/ and several other free software projects already provide LLM interence on your laptop. I'm not sure which ones support AI powered OCR, I think that isn't quite there yet, maybe stick with the traditional OCR solutions for a bit longer. But llama.cpp currently already supports 6 different multimodals models. And integrations to some IDEs also already exist, so something like Copilot is definitely there: https://continue.dev/

However, I think the desktop side, and integration into other parts of the system are still entirely missing. I'm not aware of anyone working on it. I'd like speech regognition and nice TTS on the desktop.

[-] possiblylinux127@lemmy.zip -1 points 9 months ago

I personally don't need or want such features. Its to much feature creep. Also most of the "smart features" are powered by machine learning, not AI.

[-] semperverus@lemmy.world 5 points 9 months ago

Machine learning is one of many forms of AI. You're not even being pedantic correctly.

[-] samc@feddit.uk 1 points 9 months ago

I'd argue that ML is the more general term (that could even apply to computing a line of best fit, if you're an extremist). But yeah, it's just semantics at this point

this post was submitted on 08 Feb 2024
93 points (97.0% liked)

Linux

48179 readers
1018 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS