Examples in Chat Interface not appearing in HuggingFace Spaces

I have a gradio app of a chatbot with some example questions. It works fine locally, but when I upload to HuggingFace Spaces, the example questions do not appear. That happens even if I force to use the same gradio version putting it in the requirements.txt.

Here is the section of the code where gradio components are defined:

# Predefined messages and examples
description = "AI powered assistant which answers any question related to the [CAMELS simulations](https://www.camel-simulations.org/)."
greetingsmessage = "Hi, I'm the CAMELS DocBot, I'm here to assist you with any question related to the CAMELS simulations."
example_questions = [
                    "How can I read a halo file?",
                    "Which simulation suites are included in CAMELS?",
                    "Which are the largest volumes in CAMELS simulations?",
                    "Write a complete snippet of code getting the power spectrum of a simulation"
                     ]

# Define customized Gradio chatbot
chatbot = gr.Chatbot([{"role":"assistant", "content":greetingsmessage}],
                     type="messages",
                     avatar_images=["ims/userpic.png","ims/camelslogo.jpg"],
                     height="60vh")

# Define Gradio interface
demo = gr.ChatInterface(handle_prompt,
                        type="messages",
                        title="CAMELS DocBot",
                        fill_height=True,
                        examples=example_questions,
                        theme=gr.themes.Soft(),
                        description=description,
                        cache_examples=False,
                        chatbot=chatbot)

demo.launch()

The full code can be found here

1 Like

I fixed the issue by explicitly writing the latest Gradio version in the README.md in HuggingFace Spaces rather than in the requirements:
sdk_version: 5.5.0

1 Like

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.