發表文章

使用 miniconda 建立python 開發環境

圖片
  使用 miniconda 建立python 開發環境,可以使不同專案的python 不會互相干擾 安裝 # miniconda 安裝shell curl -sL "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" > "Miniconda3.sh" bash Miniconda3.sh 安裝完畢退出console 重新進入 指令 create 新環境 conda create --name 專案名稱 python=3.10 列出所有的環境 conda env list 進入環境 conda activate 專案名稱 刪除環境 conda remove --name 專案名稱 -all 無需登入環境,可在排程中直接執行的方式 本范例使用,ollama 分析圖片 conda env list /home/bob/miniconda3/envs/ollama/bin/python \ llama.py -i https://cdn2.ettoday.net/images/8223/d8223181.jpg

/tmp 目錄資料保留時間設定

圖片
/tmp 目錄資料保留時間設定   /etc/tmpfiles.d# cat tmp.conf # 删除 /tmp 目錄下所有文件,保留時間為 2h   D /tmp 1777 root root 2h 重啟 tmpfile clear 服務 systemctl restart systemd-tmpfiles-clean   關看服務啟動狀況 systemctl list-timers systemctl list-timers | grep systemd-tmpfiles-clean

利用ollama 分析圖片

圖片
  本專案使用 ollama + python  + moeel llama3.2-vision:11b  解析本圖片的內容 安裝 ollama : curl -fsSL https://ollama.com/install.sh | sh conda create --name ollama python=3.12 conda activate ollama pip install ollama 測試ollama command mode :  ollama run deepseek-r1:32b 程式碼 trans.py : import base64 import requests import ollama import argparse def convert_image_url_to_base64(url):     response = requests.get(url)     if response.status_code == 200:         image_data = response.content         base64_encoded = base64.b64encode(image_data).decode('utf-8')         # return f"data:image/jpeg;base64,{base64_encoded}"         return base64_encoded     else:         return None def main():     parser = argparse.ArgumentParser(description='Process an image URL.')     parser.add_argument('-i', '--image_url', type=str, help='The URL of the i...

Whisper-WebUi 安裝

圖片
  首先需要有 cuda 環境,以支持whisper model 進行語音轉文字。 nvidia-smi 看cuda 環境 另需ffmpeg 可以處理聲音從影像撥離的支持。 資料來源: https://github.com/jhj0517/Whisper-WebUI?tab=readme-ov-file miniconda 安裝方式及環境: curl -sL "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" > "Miniconda3.sh" bash Miniconda3.sh conda create —name whisper python=3.10 conda activate whisper Whisper-WebUI 安裝方式: git clone https://github.com/jhj0517/Whisper-WebUI.git cd Whisper-WebUI pip install -r requirements.txt apt install ffpmeg   start-webui.sh: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/root/miniconda3/envs/whisper/lib/python3.10/site-packages/nvidia/cudnn/lib/   python app.py --server_name xxx.xxx.xxx --server_port 443   --ssl_verify True --ssl_keyfile /root/ssl/server.key --ssl_certfile /root/ssl/ettoday.pem 執行 nohup sh start-webui.sh & 在 browser 上執行 https://xxx.xxx.xxx 會得到如下圖:

上野街頭親子丼

圖片
 閒逛上野街頭 偶看到 親子丼

龍潭 桐花

圖片
 

板橋甕仔湯 

圖片