Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
| import subprocess | |
| from huggingface_hub import HfApi, Repository | |
| import gradio as gr | |
| subprocess.run(["git", "clone", "https://github.com/huggingface/diffusers.git", "diff"]) | |
| def convert(token: str, model_id: str) -> str: | |
| if token == "" or model_id == "": | |
| return """ | |
| ### Invalid input 🐞 | |
| Please fill a token and model name. | |
| """ | |
| try: | |
| api = HfApi(token=token) | |
| info = api.model_info(repo_id=model_id) | |
| return info | |
| except Exception as e: | |
| return f"#### Error: {e}" | |
| with gr.Blocks() as demo: | |
| with gr.Row(): | |
| with gr.Column(scale=50): | |
| gr.Markdown("DESCRIPTION") | |
| with gr.Column(scale=50): | |
| input_token = gr.Textbox( | |
| max_lines=1, | |
| label="Hugging Face token", | |
| ) | |
| input_model = gr.Textbox( | |
| max_lines=1, | |
| label="Model name", | |
| placeholder="textattack/distilbert-base-cased-CoLA", | |
| ) | |
| btn = gr.Button("Convert to Diffusers🧨") | |
| output = gr.Markdown(label="Output") | |
| btn.click( | |
| fn=convert, inputs=[input_token, input_model], outputs=output | |
| ) | |
| demo.launch() | |