Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -62,9 +62,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
62 |
btn_speech = gr.Button("Speech-to-Text")
|
63 |
btn_qgen = gr.Button("Question Generation")
|
64 |
|
65 |
-
|
66 |
-
|
67 |
-
# Tabs
|
68 |
with gr.Column(visible=False) as summarize_tab:
|
69 |
text = gr.Textbox(label="Enter paragraph", lines=10)
|
70 |
out = gr.Textbox(label="Summary", lines=4)
|
@@ -101,10 +99,23 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
101 |
gr.update(visible=(tab_name == "question")),
|
102 |
]
|
103 |
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
demo.launch()
|
|
|
62 |
btn_speech = gr.Button("Speech-to-Text")
|
63 |
btn_qgen = gr.Button("Question Generation")
|
64 |
|
65 |
+
# Tab sections
|
|
|
|
|
66 |
with gr.Column(visible=False) as summarize_tab:
|
67 |
text = gr.Textbox(label="Enter paragraph", lines=10)
|
68 |
out = gr.Textbox(label="Summary", lines=4)
|
|
|
99 |
gr.update(visible=(tab_name == "question")),
|
100 |
]
|
101 |
|
102 |
+
# Shared hidden input to control tab switching
|
103 |
+
hidden_tab_name = gr.Textbox(value="", visible=False)
|
104 |
+
|
105 |
+
btn_summ.click(lambda: "summarize", outputs=hidden_tab_name).then(
|
106 |
+
show_tab, inputs=hidden_tab_name, outputs=[summarize_tab, sentiment_tab, translate_tab, speech_tab, question_tab]
|
107 |
+
)
|
108 |
+
btn_sent.click(lambda: "sentiment", outputs=hidden_tab_name).then(
|
109 |
+
show_tab, inputs=hidden_tab_name, outputs=[summarize_tab, sentiment_tab, translate_tab, speech_tab, question_tab]
|
110 |
+
)
|
111 |
+
btn_trans.click(lambda: "translate", outputs=hidden_tab_name).then(
|
112 |
+
show_tab, inputs=hidden_tab_name, outputs=[summarize_tab, sentiment_tab, translate_tab, speech_tab, question_tab]
|
113 |
+
)
|
114 |
+
btn_speech.click(lambda: "speech", outputs=hidden_tab_name).then(
|
115 |
+
show_tab, inputs=hidden_tab_name, outputs=[summarize_tab, sentiment_tab, translate_tab, speech_tab, question_tab]
|
116 |
+
)
|
117 |
+
btn_qgen.click(lambda: "question", outputs=hidden_tab_name).then(
|
118 |
+
show_tab, inputs=hidden_tab_name, outputs=[summarize_tab, sentiment_tab, translate_tab, speech_tab, question_tab]
|
119 |
+
)
|
120 |
|
121 |
demo.launch()
|