anzorq commited on
Commit
d5d52b4
1 Parent(s): 59b0971

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -3
app.py CHANGED
@@ -1,7 +1,43 @@
1
  import subprocess
 
2
 
3
  subprocess.run(["git", "clone", "https://github.com/huggingface/diffusers.git", "diff"])
4
 
5
- import os
6
- for file in os.listdir():
7
- print(file)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import subprocess
2
+ import gradio as gr
3
 
4
  subprocess.run(["git", "clone", "https://github.com/huggingface/diffusers.git", "diff"])
5
 
6
+ def convert(token: str, model_id: str) -> str:
7
+
8
+ if token == "" or model_id == "":
9
+ return """
10
+ ### Invalid input 🐞
11
+ Please fill a token and model name.
12
+ """
13
+ try:
14
+ api = HfApi(token=token)
15
+ info = api.ModelInfo("nitrosocke/mo-di-diffusion")
16
+ return info
17
+
18
+ except Exception as e:
19
+ return f"#### Error: {e}"
20
+
21
+ with gr.Blocks() as demo:
22
+
23
+ with gr.Row():
24
+ with gr.Column(scale=50):
25
+ gr.Markdown("DESCRIPTION")
26
+
27
+ with gr.Column(scale=50):
28
+ input_token = gr.Textbox(
29
+ max_lines=1,
30
+ label="Hugging Face token",
31
+ )
32
+ input_model = gr.Textbox(
33
+ max_lines=1,
34
+ label="Model name",
35
+ placeholder="textattack/distilbert-base-cased-CoLA",
36
+ )
37
+
38
+ btn = gr.Button("Convert to Diffusers🧨")
39
+ output = gr.Markdown(label="Output")
40
+
41
+ btn.click(
42
+ fn=convert, inputs=[input_token, input_model], outputs=output
43
+ )