fudii0921 commited on
Commit
dbcae1e
·
verified ·
1 Parent(s): 76fbfb2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -1,9 +1,9 @@
1
  import gradio as gr
2
  from huggingface_hub import list_models
3
 
4
- def toggle_all(prmpt: str):
5
- gr.update(visible=True)
6
- return prmpt+" was 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=True):
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=resp)
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