AMKCode commited on
Commit
20aa964
·
1 Parent(s): 9663b92

initial app.py

Browse files
Files changed (1) hide show
  1. app.py +41 -0
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import shutil
3
+ import subprocess
4
+ import signal
5
+ os.environ["GRADIO_ANALYTICS_ENABLED"] = "False"
6
+ import gradio as gr
7
+
8
+ from huggingface_hub import create_repo, HfApi
9
+ from huggingface_hub import snapshot_download
10
+ from huggingface_hub import whoami
11
+ from huggingface_hub import ModelCard
12
+
13
+ from gradio_huggingfacehub_search import HuggingfaceHubSearch
14
+
15
+ from apscheduler.schedulers.background import BackgroundScheduler
16
+
17
+ HF_TOKEN = os.environ.get("HF_TOKEN")
18
+
19
+ HF_PATH = "https://huggingface.co/"
20
+
21
+ # change to include others
22
+ CONV_TEMPLATE = "tinyllama_v1_0"
23
+
24
+ def button_click(_, hf_model_id, quantization):
25
+ os.system("mkdir -p dist/models && cd dist/models")
26
+ os.system("git lfs install")
27
+ os.system("git clone " + HF_PATH + hf_model_id)
28
+ os.system("cd ../..")
29
+
30
+
31
+ return "successful"
32
+
33
+ demo = gr.Interface(
34
+ fn=button_click,
35
+ inputs = [gr.Button("Click me"),
36
+ gr.Textbox(label="HF Model ID"),
37
+ gr.Dropdown(["q4f16_1", "q4f32_1"], label="Quantization Method")],
38
+ outputs = "text"
39
+ )
40
+
41
+ demo.launch()