AMKCode's picture
initial app.py
20aa964
raw
history blame
1.05 kB
import os
import shutil
import subprocess
import signal
os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
import gradio as gr
from huggingface_hub import create_repo, HfApi
from huggingface_hub import snapshot_download
from huggingface_hub import whoami
from huggingface_hub import ModelCard
from gradio_huggingfacehub_search import HuggingfaceHubSearch
from apscheduler.schedulers.background import BackgroundScheduler
HF_TOKEN = os.environ.get("HF_TOKEN")
HF_PATH = "https://huggingface.co/"
# change to include others
CONV_TEMPLATE = "tinyllama_v1_0"
def button_click(_, hf_model_id, quantization):
os.system("mkdir -p dist/models && cd dist/models")
os.system("git lfs install")
os.system("git clone " + HF_PATH + hf_model_id)
os.system("cd ../..")
return "successful"
demo = gr.Interface(
fn=button_click,
inputs = [gr.Button("Click me"),
gr.Textbox(label="HF Model ID"),
gr.Dropdown(["q4f16_1", "q4f32_1"], label="Quantization Method")],
outputs = "text"
)
demo.launch()