sd-to-diffusers / app.py
anzorq's picture
Update app.py
d5d52b4
raw
history blame
1.18 kB
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
)