Spaces:
Sleeping
Sleeping
Update app.py
#1
by fudii0921 - opened
app.py
CHANGED
|
@@ -3,7 +3,7 @@ from huggingface_hub import list_models
|
|
| 3 |
|
| 4 |
def toggle_all(prompt):
|
| 5 |
# ここでタブの可視性を切り替えるロジックを追加
|
| 6 |
-
return gr.update(visible=
|
| 7 |
|
| 8 |
|
| 9 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
|
@@ -24,7 +24,7 @@ def list_private_models(profile: gr.OAuthProfile | None, oauth_token: gr.OAuthTo
|
|
| 24 |
f"{model.id} ({'private' if model.private else 'public'})"
|
| 25 |
for model in list_models(author=profile.username, token=oauth_token.token)
|
| 26 |
]
|
| 27 |
-
return "Models:\n\n" + "\n - ".join(models) + "."
|
| 28 |
|
| 29 |
|
| 30 |
with gr.Blocks() as demo:
|
|
@@ -42,7 +42,7 @@ with gr.Blocks() as demo:
|
|
| 42 |
m2 = gr.Markdown()
|
| 43 |
demo.load(hello, inputs=None, outputs=m1)
|
| 44 |
|
| 45 |
-
with gr.Tab("LLM", visible=
|
| 46 |
with gr.Column():
|
| 47 |
prompt = gr.Textbox(visible=True, label="プロンプト")
|
| 48 |
resp = gr.Textbox(visible=True, label="レスポンス")
|
|
@@ -50,6 +50,7 @@ with gr.Blocks() as demo:
|
|
| 50 |
|
| 51 |
show_button.click(fn=toggle_all, inputs=prompt, outputs=[tab_llm, resp])
|
| 52 |
|
| 53 |
-
demo.load(list_private_models, inputs=None, outputs=m2)
|
|
|
|
| 54 |
|
| 55 |
demo.launch()
|
|
|
|
| 3 |
|
| 4 |
def toggle_all(prompt):
|
| 5 |
# ここでタブの可視性を切り替えるロジックを追加
|
| 6 |
+
return gr.update(visible=True), prompt
|
| 7 |
|
| 8 |
|
| 9 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
|
|
|
| 24 |
f"{model.id} ({'private' if model.private else 'public'})"
|
| 25 |
for model in list_models(author=profile.username, token=oauth_token.token)
|
| 26 |
]
|
| 27 |
+
return "Models:\n\n" + "\n - ".join(models) + ".", gr.update(visible=True)
|
| 28 |
|
| 29 |
|
| 30 |
with gr.Blocks() as demo:
|
|
|
|
| 42 |
m2 = gr.Markdown()
|
| 43 |
demo.load(hello, inputs=None, outputs=m1)
|
| 44 |
|
| 45 |
+
with gr.Tab("LLM", visible=False) as tab_llm:
|
| 46 |
with gr.Column():
|
| 47 |
prompt = gr.Textbox(visible=True, label="プロンプト")
|
| 48 |
resp = gr.Textbox(visible=True, label="レスポンス")
|
|
|
|
| 50 |
|
| 51 |
show_button.click(fn=toggle_all, inputs=prompt, outputs=[tab_llm, resp])
|
| 52 |
|
| 53 |
+
#demo.load(list_private_models, inputs=None, outputs=m2)
|
| 54 |
+
demo.load(list_private_models, inputs=None, outputs=[m2, tab_llm])
|
| 55 |
|
| 56 |
demo.launch()
|