Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import list_models
|
| 3 |
|
| 4 |
-
def toggle_all(
|
| 5 |
-
|
| 6 |
-
return
|
| 7 |
|
| 8 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
| 9 |
# ^ expect a gr.OAuthProfile object as input to get the user's profile
|
|
@@ -41,12 +41,12 @@ with gr.Blocks() as demo:
|
|
| 41 |
m2 = gr.Markdown()
|
| 42 |
demo.load(hello, inputs=None, outputs=m1)
|
| 43 |
|
| 44 |
-
with gr.Tab("LLM",visible=
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
|
| 51 |
demo.load(list_private_models, inputs=None, outputs=m2)
|
| 52 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from huggingface_hub import list_models
|
| 3 |
|
| 4 |
+
def toggle_all(prompt):
|
| 5 |
+
# ここでタブの可視性を切り替えるロジックを追加
|
| 6 |
+
return gr.update(visible=True), prompt
|
| 7 |
|
| 8 |
def hello(profile: gr.OAuthProfile | None) -> str:
|
| 9 |
# ^ expect a gr.OAuthProfile object as input to get the user's profile
|
|
|
|
| 41 |
m2 = gr.Markdown()
|
| 42 |
demo.load(hello, inputs=None, outputs=m1)
|
| 43 |
|
| 44 |
+
with gr.Tab("LLM", visible=False) as tab_llm:
|
| 45 |
+
with gr.Column():
|
| 46 |
+
prompt = gr.Textbox(visible=True, label="プロンプト")
|
| 47 |
+
resp = gr.Textbox(visible=True, label="レスポンス")
|
| 48 |
+
show_button = gr.Button("RUN")
|
| 49 |
+
show_button.click(fn=toggle_all, inputs=prompt, outputs=[tab_llm, resp])
|
| 50 |
|
| 51 |
demo.load(list_private_models, inputs=None, outputs=m2)
|
| 52 |
|