# Wrapping a Griptape chat with Gradio

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwrapping-a-griptape-chat-with-gradio%2F45473%3E%5C
**Category:** 🔒 Gradio\
**Created:** [July 3, 2023, 2:08pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwrapping-a-griptape-chat-with-gradio%2F45473 "2023-07-03T14:08:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mreferre](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@mreferre](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fmreferre)%5C
**Post date:** [July 3, 2023, 2:08pm UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fwrapping-a-griptape-chat-with-gradio%2F45473%2F1 "2023-07-03T14:08:41Z")

</div>

I am trying to wrap this simple Python program ([link](https://docs.griptape.ai/en/latest/examples/talk-to-a-pdf/) to source) based on the Griptape framework into a Gradio user interface:

```auto
import io
import requests
from griptape.engines import VectorQueryEngine
from griptape.loaders import PdfLoader
from griptape.structures import Agent
from griptape.tools import KnowledgeBaseClient
from griptape.utils import Chat

namespace = "attention"

response = requests.get("https://arxiv.org/pdf/1706.03762.pdf")
engine = VectorQueryEngine()

engine.vector_store_driver.upsert_text_artifacts(
    {
        namespace: PdfLoader().load(
            io.BytesIO(response.content)
        )
    }
)

kb_client = KnowledgeBaseClient(
    description="Contains information about the Attention Is All You Need paper. "
                "Use it to answer any related questions.",
    query_engine=engine,
    namespace=namespace
)

agent = Agent(
    tools=[kb_client]
)

Chat(agent).start()

```

In addition to adding `import gradio as gr` as an import at the beginning, and removin the last line (`Chat(agent).start()`) … I am trying to figure out what object I need to wrap with Gradio.

I was assuming that Gradio would be alternative to using the `Chat` utils that ship with the framework but trying to wrap the `agent` object does not seem to be working.

The closest I can get it to work is by wrapping `Chat` as follows:

```auto
iface = gr.Interface(fn=Chat(agent).start, inputs="my input", outputs="the output")
iface.launch(share=True)

```

The program seems to be launching just fine, I can connect to the (public) endpoint created and I am shown the Gradio chat UI BUT as soon as I submit the prompt in the user interface the program spits:

```auto
Traceback (most recent call last):
  File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/routes.py", line 437, in run_predict
    output = await app.get_blocks().process_api(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 1352, in process_api
    result = await self.call_function(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/gradio/blocks.py", line 1077, in call_function
    prediction = await anyio.to_thread.run_sync(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/anyio/to_thread.py", line 33, in run_sync
    return await get_asynclib().run_sync_in_worker_thread(
  File "/home/ec2-user/.local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 877, in run_sync_in_worker_thread
    return await future
  File "/home/ec2-user/.local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 807, in run
    result = context.run(func, *args)
TypeError: start() takes 1 positional argument but 2 were given

```

Is there something obvious that I am missing?
