File size: 920 Bytes
c7ba5a2
e72dfee
 
8210474
99048eb
8210474
 
2792d0d
8210474
5f7ce14
9f6a755
8210474
2792d0d
6662558
2e8594c
fb3486d
 
8210474
 
 
fb3486d
8210474
5f7ce14
 
 
 
c7ba5a2
5f7ce14
1806007
c7ba5a2
 
e47bb4b
c7ba5a2
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import gradio as gr
import os
import sys
import subprocess
from importlib import import_module


print("Getting rustup")
subprocess.run(
    "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y",
    shell=True,
)
print("Got rustup")
myenv = os.environ.copy()
myenv["PATH"] = os.path.expanduser("~/.cargo/bin:") + myenv["PATH"]
print("RUSTC", os.path.isfile(os.path.expanduser("~/.cargo/bin/rustc")))
subprocess.run("rustc --version", shell=True, env=myenv)
subprocess.run(
    "pip install -e git+https://github.com/huggingface/tokenizers/#egg=tokenizers\&subdirectory=bindings/python",
    shell=True,
    env=myenv,
)
sys.path.append(
    os.path.join(os.getcwd(), "src", "tokenizers", "bindings", "python", "py_src")
)


import tokenizers


def greet(name):
    return "Hello " + name + "!!" + tokenizers.__version__


iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()