Can-i-run-tgi / app.py
philschmid's picture
Update app.py
7085887 verified
raw
history blame
950 Bytes
#### INSTALL LIB
import subprocess
import os
token = os.environ.get("GITHUB_TOKEN", None)
if not token:
raise ValueError("Token not found")
# Build the install command
command = f"pip install git+https://x-access-token:{token}:[email protected]/philschmid/model-recommender.git"
subprocess.run(command, shell=True, check=True)
#### INSTALL LIB
import json
import gradio as gr
from recommender.main import get_tgi_config
def greet(model_id, gpu_memory):
config = get_tgi_config(model_id, gpu_memory)
return json.dumps(config)
demo = gr.Interface(
fn=greet,
inputs=[
gr.Textbox(label="Model ID", placeholder="meta-llama/Llama-2-7b-chat-hf"),
gr.Slider(
step=4,
minimum=16,
maximum=640,
value=24,
label="GPU memory",
info="Select how much GPU memory you have available",
),
],
outputs=[gr.JSON()],
)
demo.launch()