grok-1-test / app.py
Omnibus's picture
Update app.py
cde580d verified
raw
history blame
1.06 kB
import gradio as gr
from huggingface_hub import HfApi, ModelFilter, list_models
api = HfApi()
models=[
"xai-org/grok-1"
]
def load_models():
loaded_model=[]
model_details=[]
for model in models:
try:
loaded_model.append(gr.load(f'models/{model}'))
this = api.list_models(search=model.split("/")[1],limit=100,cardData=True)
for i,m in enumerate(this):
model_details.append(m)
except Exception as e:
loaded_model.append({"ERROR":e})
try:
this = api.list_models(search=model.split("/")[1],limit=100,cardData=True)
for i,m in enumerate(this):
model_details.append(m)
except Exception as ee:
model_details.append({"ERROR":ee})
return loaded_model, model_details
with gr.Blocks() as app:
with gr.Row():
models_out=gr.JSON(label="Gradio Details")
details=gr.JSON(label="API Details")
app.load(load_models,None,[models_out,details])
app.launch()