Update app.py
Browse files
app.py
CHANGED
|
@@ -21,6 +21,10 @@ types=[
|
|
| 21 |
]
|
| 22 |
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
def load_space(model_id,d_app):
|
| 26 |
uid = uuid.uuid4()
|
|
@@ -102,7 +106,9 @@ with gr.Blocks() as build:
|
|
| 102 |
token = gr.Textbox(label="auth")
|
| 103 |
t_name = gr.Textbox(label="Space Name")
|
| 104 |
d_app = gr.Textbox(label="File", value="app.py")
|
| 105 |
-
|
|
|
|
|
|
|
| 106 |
with gr.Box():
|
| 107 |
r_s = gr.Textbox(label="Replace")
|
| 108 |
r_w = gr.Textbox(label="with:")
|
|
@@ -116,6 +122,8 @@ with gr.Blocks() as build:
|
|
| 116 |
r_t=gr.Textbox(max_lines=100)
|
| 117 |
m_t=gr.Textbox(max_lines=100)
|
| 118 |
uu=gr.Textbox(visible=False)
|
|
|
|
|
|
|
| 119 |
l_btn.click(load_space,[t_name,d_app],[r_t,uu])
|
| 120 |
r_btn.click(repl,[r_s,r_w,uu], [m_t,files])
|
| 121 |
|
|
|
|
| 21 |
]
|
| 22 |
|
| 23 |
|
| 24 |
+
def show_f(model_id,d_app,token):
|
| 25 |
+
api = HfApi(token=token)
|
| 26 |
+
author=model_id.split("/",1)[0]
|
| 27 |
+
print(api.list_spaces(author=author))
|
| 28 |
|
| 29 |
def load_space(model_id,d_app):
|
| 30 |
uid = uuid.uuid4()
|
|
|
|
| 106 |
token = gr.Textbox(label="auth")
|
| 107 |
t_name = gr.Textbox(label="Space Name")
|
| 108 |
d_app = gr.Textbox(label="File", value="app.py")
|
| 109 |
+
with gr.Row():
|
| 110 |
+
s_btn = gr.Button("show")
|
| 111 |
+
l_btn = gr.Button("Load")
|
| 112 |
with gr.Box():
|
| 113 |
r_s = gr.Textbox(label="Replace")
|
| 114 |
r_w = gr.Textbox(label="with:")
|
|
|
|
| 122 |
r_t=gr.Textbox(max_lines=100)
|
| 123 |
m_t=gr.Textbox(max_lines=100)
|
| 124 |
uu=gr.Textbox(visible=False)
|
| 125 |
+
|
| 126 |
+
s_btn.click(show_f,t_name,None)
|
| 127 |
l_btn.click(load_space,[t_name,d_app],[r_t,uu])
|
| 128 |
r_btn.click(repl,[r_s,r_w,uu], [m_t,files])
|
| 129 |
|