Skip to content

Commit

Permalink
Fix Assistant
Browse files Browse the repository at this point in the history
  • Loading branch information
artitw committed Oct 7, 2024
1 parent 0a62f08 commit 64331b0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="text2text",
version="1.6.4",
version="1.6.5",
author="artitw",
author_email="artitw@gmail.com",
description="Text2Text: Crosslingual NLP/G toolkit",
Expand Down
1 change: 0 additions & 1 deletion text2text/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@
from .identifier import Identifier
from .server import Server
from .handler import Handler
from . import utils
13 changes: 6 additions & 7 deletions text2text/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import time
import subprocess
import warnings
import importlib.resources
import requests

import text2text as t2t

Expand Down Expand Up @@ -64,12 +64,11 @@ def load_model(self):
if return_code != 0:
raise Exception("Cannot install lshw.")

inp_file = importlib.resources.files(t2t.utils) / 'ollama_install.sh'
with inp_file.open("rt") as f:
install_script = f.read()
result = run_sh(install_script)
if "Install complete." not in result and "will run in CPU-only mode." not in result:
raise Exception(result)
response = requests.get("https://ollama.com/install.sh")
install_script = response.text
result = run_sh(install_script)
if "Install complete." not in result and "will run in CPU-only mode." not in result:
raise Exception(result)

self.ollama_serve_proc = subprocess.Popen(["ollama", "serve"])
time.sleep(1)
Expand Down

0 comments on commit 64331b0

Please sign in to comment.