Can-i-run-tgi / app.py
philschmid's picture
Create app.py
d521aaf verified
raw
history blame
965 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}:x-oauth-basic@github.com/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=4000,
minimum=16_000,
maximum=640_000,
value=24_000,
label="GPU memory",
info="Select how much GPU memory you have available",
),
],
outputs=[gr.JSON()],
)
demo.launch()