Misty_Climate_Agent / README.md
n0v33n
update
7f4d90c
|
raw
history blame
5.25 kB
metadata
title: MistyClimate Agent
emoji: πŸ“ˆ
colorFrom: red
colorTo: pink
sdk: docker
pinned: false
short_description: This is a agent created using mistral models
tags:
  - agent-demo-track
Usage: Mistral

MistyClimate Agent πŸ“ˆ

This is an agent created using Mistral models, designed to process climate-related documents, analyze images, perform JSON data analysis, and convert text to speech. It provides a multi-agent system for document processing, image analysis, JSON analysis, and text-to-speech functionalities, all integrated into a user-friendly Gradio interface.

Video Demo

Below is an embedded YouTube video demonstrating the MistyClimateAgent for the Hackathon:

Watch the Demo Video

Click the image or watch the demo video on YouTube.

Features

  • Document Processing: Extract structured data from climate-related PDFs using OCR capabilities.
  • Image Analysis: Analyze image-based documents (e.g., PNG, JPG, PDF) to extract text, charts, and tables.
  • JSON Analysis: Analyze JSON data to extract insights and patterns, with a focus on climate data.
  • Text-to-Speech: Convert text analysis into speech using the gTTS library.
  • Gradio Interface: A web-based UI to interact with all features seamlessly.

Setup

This project is containerized using Docker and deployed on a Gradio Space. Follow the steps below to set up and run the project locally or on Hugging Face Spaces.

Prerequisites

  • Docker (if running locally)
  • A Mistral API key (obtain from Mistral AI)
  • Python 3.10+ (if running locally without Docker)

Installation

  1. Clone the Repository (if running locally):

    git clone <repository-url>
    cd <repository-directory>
    
  2. Install Dependencies: The project uses a requirements.txt file to manage dependencies. If running locally without Docker, install the dependencies using:

    pip install -r requirements.txt
    
  3. Set Up the Mistral API Key:

    • You will need a Mistral API key to use the Mistral models.
    • In the Gradio interface, input your API key in the "Mistral API Key" field.
  4. Run with Docker (recommended for local testing):

    • Build the Docker image:
      docker build -t mistyclimate-agent .
      
    • Run the Docker container:
      docker run -p 7860:7860 mistyclimate-agent
      
    • Access the Gradio interface at http://localhost:7860.
  5. Deploy on Hugging Face Spaces:

    • This project is already configured for Hugging Face Spaces with the sdk: docker setting.
    • Push your code to a Hugging Face Space repository.
    • The Space will automatically build and deploy using the provided Dockerfile.

Usage

  1. Access the Gradio Interface:

    • If running locally, open http://localhost:7860 in your browser.
    • If deployed on Hugging Face Spaces, visit the Space URL.
  2. Enter Your Mistral API Key:

    • In the Gradio interface, provide your Mistral API key in the designated input field.
  3. Interact with the Tabs:

    • Document Processing:
      • Upload a PDF document (e.g., a climate report).
      • Select the document type (e.g., climate_report).
      • Click "Process Document" to extract structured data in JSON format.
    • Image Analysis:
      • Upload an image file (PNG, JPG, or PDF).
      • Choose an analysis focus (e.g., text_extraction, chart_analysis).
      • Click "Analyze Image" to get structured data from the image.
    • JSON Analysis & Speech:
      • Input JSON data (e.g., temperature or emissions data).
      • Select an analysis type (e.g., content).
      • Click "Run Analysis & Speech" to analyze the JSON and generate a speech output.
    • Text-to-Speech:
      • Enter text to convert to speech (e.g., "hello, and good luck for the hackathon").
      • Click "Generate Speech" to produce and play an audio file.

File Structure

  • agent.py: Core logic for the multi-agent system, including document processing, image analysis, JSON analysis, and text-to-speech workflows.
  • app.py: Gradio interface setup and workflow orchestration.
  • requirements.txt: List of Python dependencies.
  • Dockerfile: Docker configuration for containerizing the app.
  • README.md: Project documentation (this file).

Notes

  • File Paths: In a Gradio Space, files like PDFs, images, and WAVs are handled dynamically via uploads. Output files (e.g., WAVs) are saved to /tmp/ during runtime.
  • Mistral API Key: Ensure you have a valid Mistral API key to use the models. Without it, the workflows will fail.
  • Docker Deployment: The project is configured to run in a Docker container, making it compatible with Hugging Face Spaces.

Configuration Reference

For more details on configuring Hugging Face Spaces, refer to the Hugging Face Spaces Config Reference.

Tags

  • agent-demo-track

License

This project is licensed under the MIT License. See the LICENSE file for details (if applicable).


Built with ❀️ by Samudrala Dinesh Naveen Kumar.