SparshGPT is a custom GUI application built using CustomTkinter and powered by OpenAI's proxy API. The application provides two primary features:
- TextGPT: Generates text responses to user prompts, similar to ChatGPT.
- ImageGPT: Provides insights into images based on user-provided URLs and captions.
This project demonstrates the integration of GPT-based models into a user-friendly GUI environment, catering to tasks involving text generation and image caption analysis.
- Allows users to input text prompts.
- Utilizes OpenAI’s API to generate responses based on the input.
- Displays the generated response in the GUI.
- Accepts an image URL and a caption from the user.
- Sends the data to the API to generate insights based on the image and the caption.
- Outputs the insights directly in the GUI.
- Built with CustomTkinter for a modern and responsive UI.
- Dark mode and green-themed appearance for an enhanced user experience.
- Python: Core programming language.
- CustomTkinter: Framework for building modern GUIs.
- Requests: Used for HTTP communication with the OpenAI API.
- JSON: Handles API payload and response parsing.
SparshGPT/
│
├── t.py # Main Python script containing all functionality
├── README.md # Documentation
└── requirements.txt # Python dependencies
- Description: The primary window that offers buttons to switch between
TextGPT
andImageGPT
. - Key Features:
- Welcome message.
- Buttons for accessing the two main functionalities.
- Function:
TEXT()
- Workflow:
- Opens a new window (
root_text
). - Accepts user input via a text entry box.
- Sends the input as a prompt to the GPT model using OpenAI's proxy API.
- Displays the model's response in the same window.
- Opens a new window (
- Function:
IMAGE()
- Workflow:
- Opens a new window (
root_image
). - Accepts an image URL and a caption from the user.
- Sends the inputs to the GPT model using the API.
- Displays insights generated by the model.
- Opens a new window (
- Endpoint:
https://aiproxy.sanand.workers.dev/openai/v1/chat/completions
- Authentication: Uses a Bearer token provided in the
api_key
variable. - Data Payload:
- TextGPT: Sends user input in the
messages
field. - ImageGPT: Sends a combination of text and image URL in the
messages
field.
- TextGPT: Sends user input in the
- Python Libraries:
customtkinter
requests
json
- These are listed in
requirements.txt
for easy installation.
- Launch the application.
- Click on the "Text" button.
- Enter your prompt and click "Generate."
- View the generated response in the same window.
- Launch the application.
- Click on the "Image" button.
- Enter an image URL and a relevant caption.
- Click "Generate" to get insights about the image.
- CustomTkinter:
- Provides a modern and responsive GUI for the application.
- OpenAI Proxy API:
- Serves as the backbone for GPT-based functionality.
- Error Handling:
- Basic error handling is integrated for API communication failures.
- Add error messages for invalid inputs or API failures.
- Include file upload support for images instead of URLs.
- Optimize UI for smaller screen resolutions.
- Enhance functionality with more GPT model features.
This project is licensed under the MIT License.
Feel free to reach out if you have any questions or suggestions. Happy coding! 🚀