# How to interact with my Chatbot?

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034%3E%5C
**Category:** Beginners\
**Created:** [February 15, 2025, 10:27pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034 "2025-02-15T22:27:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![savig](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@savig](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsavig)%5C
**Post date:** [February 15, 2025, 10:27pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034%2F1 "2025-02-15T22:27:54Z")

</div>

So, I have created a chatbot using Gardio, using chatbot Template.

It is running Zephyr, and works better than Falcon.AI  
I am happy.

But, I want to access the thing via API, specifically, send questions from a JS app ! I must use vanila js. No NPM or stuff.

I click on the small button “Use with API” below the page. It opens the pop up. I go under Bash, and i see the following curl code:

```auto

curl -X POST https://vernalsystems-valkyrie-svelhana.hf.space/gradio_api/call/chat -s -H "Content-Type: application/json" -d '{
    "data": [
  "What is the Capital city of Canada?",
  "Hello!!",
  1,
  0.1,
  0.1
  ]}' \
        | awk -F'"' '{ print $4}' \
        | read EVENT_ID; curl -N https://vernalsystems-valkyrie-svelhana.hf.space/gradio_api/call/chat/$EVENT_ID

```

But it is responding with a HTML file to the end of:

 ![](https://huggingface.co/front/assets/huggingface_logo.svg)

# 404

Sorry, we can’t find the page you are looking for.

Now, I change the visibility to public and try again. I only get a"EventID" back. Example:

```auto

 curl -X POST https://vernalsystems-valkyrie-svelhana.hf.space/gradio_api/call/chat -s -H "Content-Type: application/json" -d '{
    "data": [
  "What is the capital city of Canada?",
  "Hello!!",
  512,
  0.6,
  0.6
  ]}'

```

I get back :` {"event_id":"bedd427ca76042b7b1......... etc"}`

What can be done, please? Thank you.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [February 15, 2025, 10:41pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034%2F2 "2025-02-15T22:41:26Z")

</div>

This may occur due to a discrepancy between the local Gradio version and the Spaces version.

> <https://github.com/gradio-app/gradio/issues/10175>
>
> \### Describe the bug
> 
> I use the llamameta/Qwen2.5-Coder-32B-Instruct-Chat-Assist…ant model. Everything works when running in Kaggle, but as soon as I try to run the same code on my server (or my PC), an error pops up
> \`\`\`
> Traceback (most recent call last):
> File "E:\\repos\\PycharmProjects\\steamreviewai\\main.py", line 21, in \<module\>
> client = Client("llamameta/Qwen2.5-Coder-32B-Instruct-Chat-Assistant")
> File "C:\\Users\\Pr0va1der\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\gradio\_client\\client.py", line 171, in \_\_init\_\_
> self.\_info = self.\_get\_api\_info()
> File "C:\\Users\\Pr0va1der\\AppData\\Local\\Programs\\Python\\Python39\\lib\\site-packages\\gradio\_client\\client.py", line 566, in \_get\_api\_info
> raise ValueError(f"Could not fetch api info for {self.src}: {r.text}")
> ValueError: Could not fetch api info for https://llamameta-qwen2-5-coder-32b-instruct-chat-assistant.hf.space: 
> 
> Process finished with exit code 1
> 
> \`\`\`
> Here is the code that is recommended to use on Hugging Face (I used it)
> 
> \`\`\`
> from gradio\_client import Client
> 
> client = Client("llamameta/Qwen2.5-Coder-32B-Instruct-Chat-Assistant")
> result = client.predict(
> message="Hello!!",
> system\_message="You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
> max\_tokens=18000,
> temperature=0.7,
> top\_p=0.8,
> api\_name="/chat"
> )
> print(result)
> \`\`\`
> What is the problem? Maybe something is not installed on the device? I have installed all the pip packages that are required
> 
> \### Have you searched existing issues? 🔎
> 
> \- \[X\] I have searched and found no existing issues
> 
> \### Reproduction
> 
> \`\`\`
> from gradio\_client import Client
> 
> client = Client("llamameta/Qwen2.5-Coder-32B-Instruct-Chat-Assistant")
> result = client.predict(
> message="Hello!!",
> system\_message="You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
> max\_tokens=18000,
> temperature=0.7,
> top\_p=0.8,
> api\_name="/chat"
> )
> print(result)
> \`\`\`
> 
> 
> \### Screenshot
> 
> \_No response\_
> 
> \### Logs
> 
> \_No response\_
> 
> \### System Info
> 
> \`\`\`shell
> The latest version of the gradio-client from pip
> python 3.10+
> \`\`\`
> 
> 
> \### Severity
> 
> I can work around it

> Solved it! This happens when the app on the server is at a different gradio version than the gradio libraries on your local machine. I think, more so, between 4.x and 5.x versions. So you can either downgrade the version on either or upgrade. I upgraded on my local to latest 5.x ones and it worked.

---

<div class="post-metadata">

**Author:** ![savig](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@savig](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsavig)%5C
**Post date:** [February 15, 2025, 10:52pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034%2F3 "2025-02-15T22:52:26Z")

</div>

LocalGradio? I am making a cURL call from Fish Shell

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [February 15, 2025, 10:53pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034%2F4 "2025-02-15T22:53:45Z")

</div>

That’s right… it’s curl, not Client…  
My mistake.

---

<div class="post-metadata">

**Author:** ![savig](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@savig](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsavig)%5C
**Post date:** [February 15, 2025, 11:06pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034%2F5 "2025-02-15T23:06:15Z")

</div>

Yes, so now i hav this:

```auto
curl -X POST https://vernalsystems-valkyrie-svelhana.hf.space/gradio_api/call/chat \
           -H "Authorization: Bearer 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" \
           -H "Content-Type: application/json" \
           -d '{
             "data": [
               "What is the capital of canada",
               "You are a friendly Chatbot."
             ]
           }'

```

It now only returns a event id …

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [February 15, 2025, 11:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034%2F6 "2025-02-15T23:19:15Z")

</div>

Perhaps this?

> **[How to curl a Gradio App](https://www.freddyboulton.com/blog/gradio-curl)**
>
> Learn how to use d Gradio's API via curl 💪

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [February 15, 2025, 11:19pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034%2F7 "2025-02-15T23:19:44Z")

</div>

There’s a token leak. You need to invalidate it.

---

<div class="post-metadata">

**Author:** ![savig](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@savig](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsavig)%5C
**Post date:** [February 15, 2025, 11:28pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034%2F8 "2025-02-15T23:28:21Z")

</div>

PS I Managed to use this via Python

```auto
from gradio_client import Client

client = Client("vernalsystems/VALKYRIE-Svelhana",
                hf_token='hf_ding-dong')
result = client.predict(
                message="Hello!! What is the capital of Canada?",
                system_message="You are a friendly Chatbot.",
                max_tokens=1024,
                temperature=0.7,
                top_p=0.95,
                api_name="/chat"
)
print(result)

```

Now my question is: How do I do it via Javascript? Without using NPM…

I tried this:

```auto
const apiKey = "hf_ding-donh"; // Your Hugging Face API token

// Define the function to make the request
async function callGradioChat() {
    const response = await fetch("https://vernalsystems-valkyrie-svelhana.hf.space/run/chat", {
        method: "POST",
        headers: {
            "Authorization": `Bearer ${apiKey}`, // Add the API key to the Authorization header
            "Content-Type": "application/json"
        },
        body: JSON.stringify({
            data: {
message: "Hello!! What is the Capital city of Canada?", 		
		system_message: "Hello!!", 		
		max_tokens: 1, 		
		temperature: 0.1, 		
		top_p: 0.1,
}
        })
    });

    // Parse the response as JSON
    const result = await response.json();
    console.log(result);
}

// Call the function to execute the request
callGradioChat();

```

But it just returns

```auto

Object: {
  "detail": "Not Found"
}

```

I need it to work with vanilla JS or JQuery. Thank you.

---

<div class="post-metadata">

**Author:** ![savig](https://avatars.discourse-cdn.com/v4/letter/s/46a35a/32.png) [@savig](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fsavig)%5C
**Post date:** [February 15, 2025, 11:29pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fhow-to-interact-with-my-chatbot%2F141034%2F9 "2025-02-15T23:29:14Z")

</div>

Bloody …

Done! THANK YOU
