File size: 965 Bytes
d521aaf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
38
39
40
#### 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()