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

Unable to reference TextBox when loading HF Space with gr.load. #8295

Open
1 task done
s-chyi opened this issue May 15, 2024 · 0 comments
Open
1 task done

Unable to reference TextBox when loading HF Space with gr.load. #8295

s-chyi opened this issue May 15, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@s-chyi
Copy link

s-chyi commented May 15, 2024

Describe the bug

When I create an app based on chatinterface in HF Space, I can call it normally on HF. However, when I import it with gr.load("ch-yi/demo_chatinterface", src="spaces") in another HF Space or in any Python environment, errors occur. The biggest issue is that the TextBox always returns None.

https://huggingface.co/spaces/ch-yi/demo_chatinterface

  • Invoke in that HF Space
    image

  • Invoke using Python locally

import gradio as gr
demo = gr.load("ch-yi/demo_chatinterface", src="spaces").launch()

image

Here is the code on HF Space.

import gradio as gr

def slow_echo(message, history, additional_1, additional_2, additional_3, additional_4):
    for i in range(len(message)):
        yield "You typed: " + message[: i+1] + f"\nAdditional: {additional_1}, {additional_2}, {additional_3}, {additional_4}" 

with gr.Blocks() as app:
    number = gr.Number(100)
    text = gr.Textbox(value="test")
    gr.ChatInterface(fn=slow_echo, additional_inputs=[number, text]).queue()
    
app.launch()

The extra output is due to my discovery that the additional parameters after gr.load start displaying from the fifth index, rather than the original third index.

Have you searched existing issues? 🔎

  • I have searched and found no existing issues

Reproduction

import gradio as gr
demo = gr.load("ch-yi/demo_chatinterface", src="spaces").launch()

Screenshot

No response

Logs

No response

System Info

gradio version: 4.29.0

Severity

Blocking usage of gradio

@s-chyi s-chyi added the bug Something isn't working label May 15, 2024
@abidlabs abidlabs self-assigned this May 15, 2024
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