Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

welcome/greet message gr.Chatbot isnot working #10740

Closed
1 task done
hassanbsee2071 opened this issue Mar 6, 2025 · 1 comment
Closed
1 task done

welcome/greet message gr.Chatbot isnot working #10740

hassanbsee2071 opened this issue Mar 6, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@hassanbsee2071
Copy link

Describe the bug

Hi Team,

I used below code to add welcome message.

from fastapi import FastAPI
import gradio as gr
import os
from dotenv import load_dotenv
from openai import OpenAI
import os
import requests
import json
from typing import List
from dotenv import load_dotenv
from bs4 import BeautifulSoup
from IPython.display import Markdown, display, update_display
from openai import OpenAI
from kubernetes import client, config
from fastapi import FastAPI
import gradio as gr


CUSTOM_PATH = "/gradio"

app = FastAPI()

@app.get("/")
def read_main():

def greet(name, history):
    return "Hello " + name + "!"

io = gr.ChatInterface(fn=greet, type="messages", chatbot=gr.Chatbot(value=[(None, "Welcome 👋. I am an assistant")],),)

app = gr.mount_gradio_app(app, io, path=CUSTOM_PATH)

Above code is not working. On the UI there is no error and continuously loading and loading. I opened console logs in the browser and I saw below error.

Uncaught (in promise) TypeError: right-hand side of 'in' should be an object, got undefined

I tried with same code here
https://stackoverflow.com/questions/76416674/welcome-message-in-python-chatbot-using-gradio-and-openai-api
and here
#7925

but still getting the same result.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr
def greet(name, history):
    return "Hello " + name + "!"

gr.ChatInterface(fn=greet, type="messages", chatbot=gr.Chatbot(value=[(None, "Welcome 👋. I am an assistant")],),)

Screenshot

No response

Logs

System Info

Package                                  Version
---------------------------------------- ---------------
accelerate                               1.4.0
aiofiles                                 23.2.1
aiohappyeyeballs                         2.4.8
aiohttp                                  3.11.13
aiohttp-retry                            2.9.1
aiosignal                                1.3.2
annotated-types                          0.7.0
anthropic                                0.49.0
anyio                                    4.8.0
asgiref                                  3.8.1
asttokens                                3.0.0
attrs                                    25.1.0
backoff                                  2.2.1
bcrypt                                   4.3.0
beautifulsoup4                           4.13.3
bitsandbytes                             0.42.0
build                                    1.2.2.post1
cachetools                               5.5.2
certifi                                  2025.1.31
charset-normalizer                       3.4.1
chroma-hnswlib                           0.7.6
chromadb                                 0.6.3
click                                    8.1.8
coloredlogs                              15.0.1
dataclasses-json                         0.6.7
datasets                                 3.3.2
decorator                                5.2.1
Deprecated                               1.2.18
dill                                     0.3.8
distro                                   1.9.0
durationpy                               0.9
executing                                2.2.0
faiss-cpu                                1.10.0
fastapi                                  0.115.11
feedparser                               6.0.11
ffmpy                                    0.5.0
filelock                                 3.17.0
flatbuffers                              25.2.10
frozenlist                               1.5.0
fsspec                                   2024.12.0
gensim                                   4.3.3
google-ai-generativelanguage             0.6.15
google-api-core                          2.24.1
google-api-python-client                 2.162.0
google-auth                              2.38.0
google-auth-httplib2                     0.2.0
google-generativeai                      0.8.4
googleapis-common-protos                 1.69.0
gradio                                   5.20.0
gradio_client                            1.7.2
groovy                                   0.1.2
grpcio                                   1.70.0
grpcio-status                            1.70.0
grpclib                                  0.4.7
h11                                      0.14.0
h2                                       4.2.0
hpack                                    4.1.0
httpcore                                 1.0.7
httplib2                                 0.22.0
httptools                                0.6.4
httpx                                    0.28.1
httpx-sse                                0.4.0
huggingface-hub                          0.29.2
humanfriendly                            10.0
hyperframe                               6.1.0
idna                                     3.10
importlib_metadata                       8.5.0
importlib_resources                      6.5.2
ipython                                  9.0.1
ipython_pygments_lexers                  1.1.1
jedi                                     0.19.2
Jinja2                                   3.1.5
jiter                                    0.8.2
joblib                                   1.4.2
jsonpatch                                1.33
jsonpointer                              3.0.0
kubernetes                               32.0.1
langchain                                0.3.20
langchain-chroma                         0.2.2
langchain-community                      0.3.19
langchain-core                           0.3.41
langchain-openai                         0.3.7
langchain-text-splitters                 0.3.6
langsmith                                0.3.11
markdown-it-py                           3.0.0
MarkupSafe                               2.1.5
marshmallow                              3.26.1
matplotlib-inline                        0.1.7
mdurl                                    0.1.2
mmh3                                     5.1.0
modal                                    0.73.87
monotonic                                1.6
mpmath                                   1.3.0
multidict                                6.1.0
multiprocess                             0.70.16
mypy-extensions                          1.0.0
narwhals                                 1.29.0
networkx                                 3.4.2
numpy                                    1.26.4
oauthlib                                 3.2.2
ollama                                   0.4.7
onnxruntime                              1.20.1
openai                                   1.65.3
opentelemetry-api                        1.30.0
opentelemetry-exporter-otlp-proto-common 1.30.0
opentelemetry-exporter-otlp-proto-grpc   1.30.0
opentelemetry-instrumentation            0.51b0
opentelemetry-instrumentation-asgi       0.51b0
opentelemetry-instrumentation-fastapi    0.51b0
opentelemetry-proto                      1.30.0
opentelemetry-sdk                        1.30.0
opentelemetry-semantic-conventions       0.51b0
opentelemetry-util-http                  0.51b0
orjson                                   3.10.15
overrides                                7.7.0
packaging                                24.2
pandas                                   2.2.3
parso                                    0.8.4
pexpect                                  4.9.0
pillow                                   11.1.0
pip                                      24.2
plotly                                   6.0.0
posthog                                  3.18.1
prompt_toolkit                           3.0.50
propcache                                0.3.0
proto-plus                               1.26.0
protobuf                                 5.29.3
psutil                                   7.0.0
ptyprocess                               0.7.0
pure_eval                                0.2.3
pyarrow                                  19.0.1
pyasn1                                   0.6.1
pyasn1_modules                           0.4.1
pydantic                                 2.10.6
pydantic_core                            2.27.2
pydantic-settings                        2.8.1
pydub                                    0.25.1
Pygments                                 2.19.1
PyJWT                                    2.10.1
pyparsing                                3.2.1
PyPika                                   0.48.9
pyproject_hooks                          1.2.0
python-dateutil                          2.9.0.post0
python-dotenv                            1.0.1
python-multipart                         0.0.20
pytz                                     2025.1
PyYAML                                   6.0.2
regex                                    2024.11.6
requests                                 2.32.3
requests-oauthlib                        2.0.0
requests-toolbelt                        1.0.0
rich                                     13.9.4
rsa                                      4.9
ruff                                     0.9.9
safehttpx                                0.1.6
safetensors                              0.5.3
scikit-learn                             1.6.1
scipy                                    1.13.1
semantic-version                         2.10.0
sentence-transformers                    3.4.1
setuptools                               75.8.2
sgmllib3k                                1.0.0
shellingham                              1.5.4
sigtools                                 4.0.1
six                                      1.17.0
smart-open                               7.1.0
sniffio                                  1.3.1
soupsieve                                2.6
speedtest-cli                            2.1.3
SQLAlchemy                               2.0.38
stack-data                               0.6.3
starlette                                0.46.0
sympy                                    1.13.1
synchronicity                            0.9.11
tenacity                                 9.0.0
threadpoolctl                            3.5.0
tiktoken                                 0.9.0
tokenizers                               0.21.0
toml                                     0.10.2
tomlkit                                  0.13.2
torch                                    2.6.0
tqdm                                     4.67.1
traitlets                                5.14.3
transformers                             4.49.0
twilio                                   9.4.6
typer                                    0.15.2
types-certifi                            2021.10.8.3
types-toml                               0.10.8.20240310
typing_extensions                        4.12.2
typing-inspect                           0.9.0
tzdata                                   2025.1
uritemplate                              4.1.1
urllib3                                  2.3.0
uvicorn                                  0.34.0
uvloop                                   0.21.0
watchfiles                               1.0.4
wcwidth                                  0.2.13
websocket-client                         1.8.0
websockets                               15.0
wrapt                                    1.17.2
xxhash                                   3.5.0
yarl                                     1.18.3
zipp                                     3.21.0
zstandard                                0.23.0

Severity

Blocking usage of gradio

@hassanbsee2071 hassanbsee2071 added the bug Something isn't working label Mar 6, 2025
@abidlabs
Copy link
Member

abidlabs commented Mar 6, 2025

Hi @hassanbsee2071 you are mixing up the format of the messages. You have specified type="messages" but you are supplying the Chatbot value as "tuples". Please see the chatbot docs:

You might also find a placeholder useful:

@abidlabs abidlabs closed this as not planned Won't fix, can't repro, duplicate, stale Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants