Spaces:
Runtime error
Runtime error
| import gradio as gr | |
| import os | |
| import sys | |
| import subprocess | |
| from importlib import import_module | |
| print("Getting rustup") | |
| subprocess.run( | |
| "cu" + "rl --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, | |
| ) | |
| tokenizers = import_module("tokenizers") | |
| def greet(name): | |
| return "Hello " + name + "!!" + tokenizers.__version__ | |
| iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
| iface.launch() | |