Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 1,180 Bytes
431af92 d5d52b4 431af92 54b4787 d5d52b4 |
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 41 42 43 44 |
import subprocess
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.ModelInfo("nitrosocke/mo-di-diffusion")
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
)
|