-
Notifications
You must be signed in to change notification settings - Fork 166
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
Error when using setup using bash #32
Comments
Hey @AhmedMohammedMostafa I just updated the image! Please try again with the tag docker pull zeroxeli/readme-ai:0.0.4 And to run: # Run with Docker
docker run -it \
-e OPENAI_API_KEY="YOUR_API_KEY" \
-v "$(pwd)":/app \
-w /app zeroxeli/readme-ai:0.0.4 \
python src/main.py -o readme-ai.md -r https://github.com/eli64s/readme-ai |
@eli64s Worked but got an error INFO README-AI is now executing.
INFO OpenAI API key validation successful.
INFO Model: {'endpoint': 'https://api.openai.com/v1/chat/completions', 'engine': 'gpt-3.5-turbo', 'encoding': 'cl100k_base', 'rate_limit': 5, 'tokens': 600, 'tokens_max': 4000, 'temperature': 0.9, 'api_key': '****************'}
INFO Repository: GitConfig(repository='https://github.com/AhmedMohammedMostafa/Reverse-Image-Search', name='Reverse-Image-Search')
INFO Dependencies: ['', '_document.js', 'cors', 'json5', 'express', 'helmet', 'javascript', 'jsconfig.json', 'UploadTab.jsx', 'upload.js', '.eslintrc.json', 'search.js', 'weaviate-ts-client', 'jsx', 'markdown', 'next', 'json', 'weaviate.js', 'index.js', 'package.json', 'next.config.js', '.gitignore', 'react', 'react-dom', 'eslint', 'globals.css', 'js', 'SearchTab.jsx', 'ant-design', 'stored-images.js', 'package-lock.json', 'yml', 'svg', 'weaviate-client', 'docker-compose.yml', 'README.md', 'vercel.svg', 'antd', '_app.js', 'md', 'eslint-config-next', 'axios', 'next.svg', 'Images.jsx', 'yaml', 'css', 'hello.js']
INFO Total files: 27
WARNING Ignoring file: README.md
WARNING Ignoring file: client/package.json
WARNING Ignoring file: client/jsconfig.json
WARNING Ignoring file: client/.eslintrc.json
WARNING Ignoring file: client/docker-compose.yml
WARNING Ignoring file: client/package-lock.json
WARNING Ignoring file: client/README.md
WARNING Ignoring file: client/.gitignore
WARNING Ignoring file: client/public/vercel.svg
WARNING Ignoring file: client/public/next.svg
WARNING Ignoring file: api/package.json
WARNING Ignoring file: api/package-lock.json
WARNING Ignoring file: api/.gitignore
ERROR Task failed with exception: RetryError[<Future at 0x5505283f70 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x550646deb0 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x5504c26190 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x5506488c70 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x55052ad7c0 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x5505299400 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x55052834f0 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x5505304190 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x55052998b0 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x5505216b20 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x55052ad8e0 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x5505304760 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x550521ca90 state=finished raised AttributeError>]
ERROR Task failed with exception: RetryError[<Future at 0x550521c790 state=finished raised AttributeError>]
ERROR Exception: RetryError[<Future at 0x55052a8d30 state=finished raised AttributeError>]
INFO README file generated at: /app/readme-ai.md
unhandled exception during asyncio.run() shutdown
task: <Task finished name='Task-17' coro=<OpenAIHandler.generate_text() done, defined at /usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py:86> exception=RetryError(<Future at 0x5504b3c4f0 state=finished raised AttributeError>)>
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 51, in write
await self._stream.send(item=buffer)
File "/usr/local/lib/python3.9/site-packages/anyio/streams/tls.py", line 203, in send
await self._call_sslobject_method(self._ssl_object.write, item)
File "/usr/local/lib/python3.9/site-packages/anyio/streams/tls.py", line 169, in _call_sslobject_method
await self.transport_stream.send(self._write_bio.read())
File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 1233, in send
raise ClosedResourceError
anyio.ClosedResourceError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 572, in __aiter__
async for chunk in self._connection._receive_response_body(
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 313, in _receive_response_body
event = await self._receive_stream_event(request, stream_id)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 333, in _receive_stream_event
await self._receive_events(request, stream_id)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 385, in _receive_events
await self._write_outgoing_data(request)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 481, in _write_outgoing_data
raise exc
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 469, in _write_outgoing_data
await self._network_stream.write(data_to_send, timeout)
File "/usr/local/lib/python3.9/site-packages/httpcore/_backends/anyio.py", line 51, in write
await self._stream.send(item=buffer)
File "/usr/local/lib/python3.9/contextlib.py", line 137, in __exit__
self.gen.throw(typ, value, traceback)
File "/usr/local/lib/python3.9/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.WriteError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/src/model.py", line 169, in generate_text
response = await self.http_client.post(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1848, in post
return await self.request(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1631, in send
raise exc
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1625, in send
await response.aread()
File "/usr/local/lib/python3.9/site-packages/httpx/_models.py", line 909, in aread
self._content = b"".join([part async for part in self.aiter_bytes()])
File "/usr/local/lib/python3.9/site-packages/httpx/_models.py", line 909, in <listcomp>
self._content = b"".join([part async for part in self.aiter_bytes()])
File "/usr/local/lib/python3.9/site-packages/httpx/_models.py", line 927, in aiter_bytes
async for raw_bytes in self.aiter_raw():
File "/usr/local/lib/python3.9/site-packages/httpx/_models.py", line 985, in aiter_raw
async for raw_stream_bytes in self.stream:
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 146, in __aiter__
async for chunk in self._stream:
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 239, in __aiter__
async for part in self._httpcore_stream:
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 347, in __aiter__
async for part in self._stream:
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 581, in __aiter__
await self.aclose()
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 589, in aclose
await self._connection._response_closed(stream_id=self._stream_id)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 407, in _response_closed
async with self._state_lock:
File "/usr/local/lib/python3.9/site-packages/httpcore/_synchronization.py", line 53, in __aenter__
await self._anyio_lock.acquire()
File "/usr/local/lib/python3.9/site-packages/anyio/_core/_synchronization.py", line 131, in acquire
await event.wait()
File "/usr/local/lib/python3.9/asyncio/locks.py", line 226, in wait
await fut
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 50, in __call__
result = await fn(*args, **kwargs)
File "/app/src/model.py", line 194, in generate_text
except openai.OpenAIException as excinfo:
AttributeError: module 'openai' has no attribute 'OpenAIException'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 47, in __call__
do = self.iter(retry_state=retry_state)
File "/usr/local/lib/python3.9/site-packages/tenacity/__init__.py", line 326, in iter
raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x5504b3c4f0 state=finished raised AttributeError>]
unhandled exception during asyncio.run() shutdown
task: <Task finished name='Task-19' coro=<OpenAIHandler.generate_text() done, defined at /usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py:86> exception=RetryError(<Future at 0x550521aac0 state=finished raised AttributeError>)>
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/h2/connection.py", line 224, in process_input
func, target_state = self._transitions[(self.state, input_)]
KeyError: (<ConnectionState.CLOSED: 3>, <ConnectionInputs.RECV_DATA: 11>)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 148, in handle_async_request
status, headers = await self._receive_response(
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 292, in _receive_response
event = await self._receive_stream_event(request, stream_id)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 333, in _receive_stream_event
await self._receive_events(request, stream_id)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 361, in _receive_events
events = await self._read_incoming_data(request)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 454, in _read_incoming_data
events: typing.List[h2.events.Event] = self._h2_state.receive_data(data)
File "/usr/local/lib/python3.9/site-packages/h2/connection.py", line 1463, in receive_data
events.extend(self._receive_frame(frame))
File "/usr/local/lib/python3.9/site-packages/h2/connection.py", line 1487, in _receive_frame
frames, events = self._frame_dispatch_table[frame.__class__](frame)
File "/usr/local/lib/python3.9/site-packages/h2/connection.py", line 1673, in _receive_data_frame
events = self.state_machine.process_input(
File "/usr/local/lib/python3.9/site-packages/h2/connection.py", line 228, in process_input
raise ProtocolError(
h2.exceptions.ProtocolError: Invalid input ConnectionInputs.RECV_DATA in state ConnectionState.CLOSED
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/src/model.py", line 169, in generate_text
response = await self.http_client.post(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1848, in post
return await self.request(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1530, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1617, in send
response = await self._send_handling_auth(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1645, in _send_handling_auth
response = await self._send_handling_redirects(
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1682, in _send_handling_redirects
response = await self._send_single_request(request)
File "/usr/local/lib/python3.9/site-packages/httpx/_client.py", line 1719, in _send_single_request
response = await transport.handle_async_request(request)
File "/usr/local/lib/python3.9/site-packages/httpx/_transports/default.py", line 353, in handle_async_request
resp = await self._pool.handle_async_request(req)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 262, in handle_async_request
raise exc
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection_pool.py", line 245, in handle_async_request
response = await connection.handle_async_request(request)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/connection.py", line 96, in handle_async_request
return await self._connection.handle_async_request(request)
File "/usr/local/lib/python3.9/site-packages/httpcore/_async/http2.py", line 167, in handle_async_request
await self._response_closed(stream_id=stream_id)
File "/usr/local/lib/python3.9/site-packages/anyio/_core/_synchronization.py", line 143, in acquire
await cancel_shielded_checkpoint()
File "/usr/local/lib/python3.9/site-packages/anyio/lowlevel.py", line 61, in cancel_shielded_checkpoint
await get_asynclib().cancel_shielded_checkpoint()
File "/usr/local/lib/python3.9/site-packages/anyio/_backends/_asyncio.py", line 471, in cancel_shielded_checkpoint
await sleep(0)
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 641, in sleep
await __sleep0()
File "/usr/local/lib/python3.9/asyncio/tasks.py", line 630, in __sleep0
yield
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 50, in __call__
result = await fn(*args, **kwargs)
File "/app/src/model.py", line 194, in generate_text
except openai.OpenAIException as excinfo:
AttributeError: module 'openai' has no attribute 'OpenAIException'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 88, in async_wrapped
return await fn(*args, **kwargs)
File "/usr/local/lib/python3.9/site-packages/tenacity/_asyncio.py", line 47, in __call__
do = self.iter(retry_state=retry_state)
File "/usr/local/lib/python3.9/site-packages/tenacity/__init__.py", line 326, in iter
raise retry_exc from fut.exception()
tenacity.RetryError: RetryError[<Future at 0x550521aac0 state=finished raised AttributeError>]
INFO README-AI execution complete. |
Just made one more update - try once more to re-pull the 0.0.4 image. |
@AhmedMohammedMostafa With the latest docker image I was able to generate this readme.md for your example repository: readme.md
|
Feature | Description |
---|---|
⚙️ Architecture | The system follows a client-server architecture where the client is built using React.js and Next.js, and the server uses Express.js. A GraphQL-based search engine called Weaviate is used for storing and retrieving images. |
📖 Documentation | The codebase lacks comprehensive documentation. However, the provided summary gives a brief overview of each file, which helps in understanding its purpose and functionality. |
🔗 Dependencies | The system relies on various external dependencies such as Express.js, React.js, Next.js, Ant Design, Axios, and Weaviate. These libraries provide functionality for server handling, UI components, styling, API requests, and search capabilities. |
🧩 Modularity | The codebase is organized into separate files for different functionalities such as image management, searching, file upload, server setup, and UI components. This modular approach improves maintainability and reusability. |
✔️ Testing | No specific information is provided about testing strategies and tools in the codebase. It would be beneficial to include unit tests or integration tests to ensure code quality and avoid regressions. |
⚡️ Performance | The codebase does not include extensive performance optimizations. However, using React.js and Next.js frameworks can help improve performance through server-side rendering and client-side optimizations. |
🔐 Security | The codebase handles security by configuring security headers in the server setup to protect against common vulnerabilities. It also includes support for CORS and implements error handling for potential security-related issues. |
🔀 Version Control | The codebase is version controlled using Git and is hosted on GitHub. The Git repository allows for collaborative development, code branching, merging, and version history tracking. |
🔌 Integrations | The system integrates with the Weaviate search engine for image storage, retrieval, and searching. It also utilizes external libraries like Ant Design for UI components and Axios for handling API requests. |
📶 Scalability | The system's scalability depends on the scalability of the utilized components, frameworks, and services such as React.js, Next.js, Weaviate, and the hosting infrastructure. With proper optimizations and scaling practices, the system should be able to handle increased load and growth. |
📂 Project Structure
repo
├── README.md
├── api
│ ├── index.js
│ ├── package-lock.json
│ ├── package.json
│ ├── routes
│ │ ├── search.js
│ │ ├── stored-images.js
│ │ └── upload.js
│ └── weaviate.js
└── client
├── README.md
├── components
│ ├── Images.jsx
│ ├── SearchTab.jsx
│ └── UploadTab.jsx
├── docker-compose.yml
├── jsconfig.json
├── next.config.js
├── package-lock.json
├── package.json
├── pages
│ ├── _app.js
│ ├── _document.js
│ ├── api
│ │ └── hello.js
│ └── index.js
├── public
│ ├── favicon.ico
│ ├── next.svg
│ └── vercel.svg
└── styles
└── globals.css
9 directories, 25 files
🧩 Modules
Api
File | Summary |
---|---|
index.js | The provided code sets up an Express server with middleware for JSON parsing, security headers, and handling CORS. It also defines routes for managing images, searching, and file uploads. The server runs on port 3001. |
weaviate.js | The code snippet creates a client for communicating with a Weaviate server. It sets up a schema configuration for an "Images" class, specifying image and text properties. Finally, it creates the class in the Weaviate server. |
hello.js | This code snippet is a Next.js API route that returns a JSON response with a name value of "John Doe" and a status code of 200. It handles incoming requests and sends a response back to the client. |
Routes
File | Summary |
---|---|
stored-images.js | The code sets up a router to handle a GET request to retrieve images from a Weaviate server. It performs a search query to get all images by calling a client module. It then extracts the image data from the response and returns it as a JSON array of base64 objects. If there is an error, it sends a 500 status code with an error message. |
upload.js | This code snippet defines a router in an Express.js application that handles a file upload functionality. Using a provided client module, it takes in a base64 encoded image and a name from the request body, creates a new object with these properties in Weaviate (a GraphQL-based search engine), and responds with a success message or an error if the upload fails. |
search.js | This code snippet sets up an API endpoint'/search' that uses the Weaviate client to perform a search query for images. It extracts the result images and sends them as a response to the client. |
Client
File | Summary |
---|---|
next.config.js | The code snippet sets the reactStrictMode value to true in the next.config.js file, allowing strict mode only for React. No other functionality is added or modified. |
Styles
File | Summary |
---|---|
globals.css | This code snippet sets various CSS variables for colors, gradients, and styles. It also includes a dark mode variant based on the prefers-color-scheme media query. The variables are used to customize the appearance of elements on the web page. |
Components
File | Summary |
---|---|
UploadTab.jsx | This code snippet is a React component that allows users to upload and preview images. It utilizes the Ant Design library and axios for API requests. Core functionalities include previewing the uploaded image, handling file uploading, and managing the state of uploaded files. Additional features include custom upload actions, error handling, and UI styling. |
SearchTab.jsx | This code snippet is a React component that allows users to upload an image and search for similar images. It uses Antd components for UI elements such as the upload button and image display. When the user selects an image, it is sent as a POST request to an API endpoint using axios. The resulting images are then displayed on the page. |
Images.jsx | The provided code snippet is a React component that displays a grid of images in an "Image Wall" layout. It uses the Ant Design library to render and preview the images. The images are sourced from the provided URLs and are displayed in a group using the Image.PreviewGroup component. Each image is displayed with a width of 200px and padding of 10px. |
Pages
File | Summary |
---|---|
_app.js | The code snippet imports a global CSS file and exports a function component called App. It passes down all the props received by the component to the Component prop. This allows the App component to render any components or pages and pass their props to them. |
index.js | The provided code snippet is a Next.js page component that renders a UI with multiple tabs using the Ant Design library. Each tab represents a different functionality-uploading an image, searching an image, or viewing all images. The component also includes some head metadata for the page. |
_document.js | The code snippet is a Next.js Document component. It renders an HTML document with an English language attribute. The Head component manages the document's metadata. The body includes the Main component, responsible for rendering page content, and NextScript component, which adds necessary scripts. |
🚀 Getting Started
✔️ Prerequisites
Before you begin, ensure that you have the following prerequisites installed:
ℹ️ Requirement 1
ℹ️ Requirement 2
ℹ️ ...
📦 Installation
- Clone the Reverse-Image-Search repository:
git clone https://github.com/AhmedMohammedMostafa/Reverse-Image-Search
- Change to the project directory:
cd Reverse-Image-Search
- Install the dependencies:
npm install
🎮 Using Reverse-Image-Search
node app.js
🧪 Running Tests
npm test
🗺 Roadmap
ℹ️ Task 1: Implement X
ℹ️ Task 2: Refactor Y
ℹ️ ...
🤝 Contributing
Contributions are always welcome! Please follow these steps:
- Fork the project repository. This creates a copy of the project on your account that you can modify without affecting the original project.
- Clone the forked repository to your local machine using a Git client like Git or GitHub Desktop.
- Create a new branch with a descriptive name (e.g.,
new-feature-branch
orbugfix-issue-123
).
git checkout -b new-feature-branch
- Make changes to the project's codebase.
- Commit your changes to your local branch with a clear commit message that explains the changes you've made.
git commit -m 'Implemented new feature.'
- Push your changes to your forked repository on GitHub using the following command
git push origin new-feature-branch
- Create a new pull request to the original project repository. In the pull request, describe the changes you've made and why they're necessary.
The project maintainers will review your changes and provide feedback or merge them into the main branch.
📄 License
This project is licensed under the ℹ️ INSERT-LICENSE-TYPE
License. See the LICENSE file for additional info.
👏 Acknowledgments
ℹ️ List any resources, contributors, inspiration, etc.
when using this
when using the pwd one it makes an error
|
@AhmedMohammedMostafa Just updated the image to work with multiple platforms. Try the following: docker pull zeroxeli/readme-ai:latest
docker run -it \
-e OPENAI_API_KEY="YOUR_API_KEY" \
-v "$(pwd)":/app zeroxeli/readme-ai:latest \
readmeai -o readme-ai.md -r https://github.com/eli64s/readme-ai |
Error and when using docker to pull, it finishes but when running the python command it says
The text was updated successfully, but these errors were encountered: