Code Monkey home page Code Monkey logo

Comments (4)

sachin-aakash avatar sachin-aakash commented on June 5, 2024

Facing the same issue as well.

from gradio.

freddyaboulton avatar freddyaboulton commented on June 5, 2024

Hi @yangmingbai - is it possible the api is returning an empty string in res_data["data"]["images"]?

@sachin-aakash , are you using the same demo?

from gradio.

yangmingbai avatar yangmingbai commented on June 5, 2024

@freddyaboulton,Thanks,This is an error raised by requests, requests.Post throw an error "Connection aborted.RemoteDisconnected('Remote end closed connection without response')", Thanks again!

from gradio.

sachin-aakash avatar sachin-aakash commented on June 5, 2024

Hi @yangmingbai - is it possible the api is returning an empty string in res_data["data"]["images"]?

@sachin-aakash , are you using the same demo?

No, here is my code and the error -

def pdf_process(file):
    pdf_file_path = file
    dir_location = os.path.dirname(pdf_file_path[0])
    filename = os.path.split(pdf_file_path[0])
    pdf_name = filename[1].split(".pdf")[0]
    command = ["node", "pdfToImageDynamic.js", quote(pdf_file_path[0]), dir_location, pdf_name]
    subprocess.run(command, check=True)
    image_name = os.path.join(dir_location,pdf_name + ".1.png")
    try:
        elements = partition_image(filename=image_name, strategy=strategy,infer_table_structure=True)
        elements_to_json(elements, filename=f"{image_name}.json")
        output_final =  process_json_file(f"{image_name}.json",dir_location,pdf_name)
        print(output_final)
        return output_final

    except subprocess.CalledProcessError as e:
                       print("Error" + e.output)
                       pass

as you can see it is printing out the path to the file that i am returning -

/private/var/folders/lx/kvs2jbr52gj0ll9mcpm35j4c0000gn/T/gradio/30a2a6abd0a693be05828e4645c14d2839bbae2f/Australia and New Zealand Banking Group April Green Bean Packagingprompt_2.txt
Traceback (most recent call last):
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio/queueing.py", line 527, in process_events
    response = await route_utils.call_process_api(
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio/route_utils.py", line 270, in call_process_api
    output = await app.get_blocks().process_api(
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio/blocks.py", line 1870, in process_api
    data = [
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio/blocks.py", line 1871, in <listcomp>
    await self.postprocess_data(fn_index, list(o), state)
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio/blocks.py", line 1725, in postprocess_data
    outputs_cached = await processing_utils.async_move_files_to_cache(
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio/processing_utils.py", line 479, in async_move_files_to_cache
    return await client_utils.async_traverse(
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio_client/utils.py", line 999, in async_traverse
    return await func(json_obj)
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio/processing_utils.py", line 453, in _move_to_cache
    temp_file_path = await block.async_move_resource_to_block_cache(
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio/blocks.py", line 286, in async_move_resource_to_block_cache
    temp_file_path = processing_utils.save_file_to_cache(
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio/processing_utils.py", line 257, in save_file_to_cache
    temp_dir = hash_file(file_path)
  File "/Users/schhatbar/anaconda3/envs/unity/lib/python3.9/site-packages/gradio/processing_utils.py", line 189, in hash_file
    with open(file_path, "rb") as f:
IsADirectoryError: [Errno 21] Is a directory: '/'

This code was working fine before i updated gradio to the latest version.

from gradio.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.