In my space my gr.ClearButton
is not working. I am not understanding, how can I fix it? I have tried different solutions provided here but nothing is working for me. How can I make the gr.ClearButton
working like a ‘clear’ button works in gr.Interface
? I am also trying to add button styles using CSS. I am using elem_id
, it is also not working after adding ID in my CSS file. Can anyone help me please?
My space link: Bangla PoS Taggers - a Hugging Face Space by musfiqdehan
Below is my code:
with gr.Blocks(css="styles.css") as demo:
gr.HTML("<h1>Bangla PoS Taggers</h1>")
gr.HTML("<p>Translate a sentence from Bangla to English and then tag the PoS of the translated sentence.</p>")
with gr.Row():
with gr.Column():
inputs = [
gr.Textbox(
label="Enter Bangla Sentence",
placeholder="বাংলা বাক্য লিখুন"
),
gr.Dropdown(
choices=["Google", "BanglaNMT", "MyMemory"],
label="Select a Translator",
value="Google"
),
gr.Dropdown(
choices=["spaCy", "NLTK", "Flair", "TextBlob"],
label="Select a PoS Tagger",
value="spaCy"
)
]
btn = gr.Button(value="Submit", elem_id="btn")
btn_clear = gr.ClearButton(value="Clear")
with gr.Column():
outputs = [
gr.Textbox(label="English Translation"),
RichTextbox(label="PoS Tags"),
gr.Textbox(label="Overall PoS Tagging Accuracy")
]
btn.click(bn_postagger, inputs, outputs)
btn_clear.click(None, inputs=[], outputs=[])
gr.Examples([
["বাংলাদেশ দক্ষিণ এশিয়ার একটি সার্বভৌম রাষ্ট্র।"],
["বাংলাদেশের সংবিধানিক নাম কি?"],
["বাংলাদেশের সাংবিধানিক নাম গণপ্রজাতন্ত্রী বাংলাদেশ।"],
["তিনজনের কেউই বাবার পথ ধরে প্রযুক্তি দুনিয়ায় হাঁটেননি।"],
["বিশ্বের আরও একটি সেরা ক্লাব।"]
], inputs)
# Launch the Gradio app
if __name__ == "__main__":
demo.launch()