0

Suppose that I have a python gradio interface with a text box in the default "/" path of an html/python website and I want to have a text response in the interface carry over to another textbox/interface in the "/other" path; how are we able to go about doing this?

Knowing about gradio itself, while it is a great way to build an interface for a single model, I reckon one of the shortcomings is that it's quite challenging to make multiple models have a sort of connection. To account for that, I'm trying to use fastapi and mount the gradio apps on an object instance akin to the documentation https://gradio.app/sharing-your-app/#mounting-within-another-fastapi-app though I find that I'm having either trouble or errors getting the input to carry through. For example:

'''@app get response returning index and other html here,
with gradio apps embedded in the form of html iframes
'''
inp = gr.Interface(
    fn=transcribe,
    inputs=[
        gr.inputs ...
    ],
    outputs=[]
    )
outp = gr.Interface(
    fn=transcribe,
    inputs=[],
    outputs=[
        gr.Textbox(...)
    ],
    share=True)
app = gr.mount_gradio_app(app, inp, path='/')
app = gr.mount_gradio_app(app, outp, path='/other')

if __name__ == "__main__":
  import uvicorn
  uvicorn.run(app)

I'm may be using some functions wrong as I'm not too familiar with using gradio interfaces, so please do share the correct way of approach.

  • It's unclear. Why are you using two ```Interface``` instances? Why not use just one ```Blocks```? See [Multiple Data Flows](https://www.gradio.app/guides/blocks-and-event-listeners#multiple-data-flows). – relent95 Aug 11 '23 at 06:28
  • Hi @relent95, my apologies if I confused you. In my question I mentioned that there's a need for two interfaces to communicate through each other across web pages (thus I have them separate as html iframes); where the user can get redirected to another path of the site with another section instead of having a single webpage with two blocks that modify each other. How can I edit my question to clarify? – InsanityC. Aug 11 '23 at 21:19
  • This is an XY problem. What is your goal? You need to define an example system and provide an example scenario. You are not running two web servers. Then why do you need to use iframes to embed web pages? – relent95 Aug 12 '23 at 00:00

0 Answers0