mango-torch

byFc mobile

import torch from diffusers import StableDiffusionImg2ImgPipeline from PIL import Image import gradio as gr # Load model once device = "cuda" if torch.cuda.is_available() else "cpu" pipe = StableDiffusionImg2ImgPipeline.from_pretrained( "runwayml/stable-diffusion-v1-5", torch_dtype=torch.float16 if device == "cuda" else torch.float32 ).to(device) # Function to process image def edit_image(input_image, prompt, strength, guidance): if input_image is None: return None image = input_image.convert("RGB").resize((512, 512)) result = pipe( prompt=prompt, image=image, strength=strength, guidance_scale=guidance ) return result.images[0] # UI Layout app = gr.Interface( fn=edit_image, inputs=[ gr.Image(type="pil", label="Upload Image"), gr.Textbox(label="Prompt", placeholder="Describe the edit (e.g. futuristic, anime, cinematic lighting)"), gr.Slider(0.1, 1.0, value=0.6, label="Strength (change level)"), gr.Slider(1, 15, value=7.5, label="Guidance Scale") ], outputs=gr.Image(label="Edited Image"), title="AI Image-to-Image Editor", description="Upload an image and describe how you want it edited." ) # Launch app app.launch()

Landing
Landing

Comments (0)

No comments yet. Be the first!

System Requirements

System Requirement Document
Page 1 of 4

System Requirements Document (SRD) for Mango-Torch

1. Introduction

This document outlines the system requirements for the Mango-Torch project, an AI-powered image editing tool designed for users in the UAE (AE) and beyond. Mango-Torch leverages advanced machine learning models to provide a seamless and intuitive interface for editing images based on user prompts. The tool is built with a focus on adaptability, scalability, and user-friendliness.

2. System Overview

Mango-Torch is an interactive AI-driven image editing tool that utilizes the Stable Diffusion model to transform user-uploaded images based on textual prompts. The system is designed to operate efficiently on both GPU and CPU environments, ensuring accessibility for a wide range of users. The tool provides a clean, intuitive interface powered by Gradio, enabling users to upload images, input prompts, and adjust parameters such as strength and guidance scale for precise control over edits.

Key features include:

  • Real-time image editing using AI.
  • Adjustable parameters for customization.
  • Support for high-quality image outputs.
  • Device adaptability for optimal performance.

The system is targeted at creative professionals, hobbyists, and anyone looking to enhance or transform images with minimal effort.

3. Functional Requirements

  • As a User, I should be able to upload an image for editing.
  • As a User, I should be able to input a textual prompt describing the desired edit.
  • As a User, I should be able to adjust the strength of the edit using a slider.
  • As a User, I should be able to adjust the guidance scale using a slider.
  • As a User, I should be able to view the edited image output.
  • As a User, I should be able to download the edited image.
  • As a User, I should be able to compare the original and edited images side-by-side.
  • As a User, I should be able to process multiple images in a batch.
  • As a User, I should be able to toggle advanced features like inpainting or masking specific regions.
Page 2 of 4

4. User Personas

4.1 Creative Professional

  • Description: Graphic designers, photographers, and digital artists looking for advanced tools to enhance their work.
  • Needs: High-quality outputs, customizable parameters, and batch processing capabilities.

4.2 Hobbyist

  • Description: Casual users exploring AI-powered tools for personal projects or social media content.
  • Needs: Simple interface, quick results, and easy-to-use features.

4.3 Developer/Tech Enthusiast

  • Description: Developers and AI enthusiasts experimenting with image editing technologies.
  • Needs: Access to advanced features, model variants, and detailed documentation.

5. Visuals Colors and Theme

Color Palette

The Mango-Torch project adopts a vibrant and modern color scheme to reflect creativity and innovation:

  • Background: #1E1E2F (Deep Midnight Blue)
  • Surface: #2A2A3C (Charcoal Gray)
  • Text: #F5F5F7 (Soft White)
  • Accent: #FF9800 (Vivid Mango Orange)
  • Muted: #757575 (Neutral Gray)

This palette ensures high contrast for readability while maintaining a visually appealing aesthetic.

6. Signature Design Concept

Page 3 of 4

Interactive "Torchlight" Landing Page

The Mango-Torch homepage will feature a dynamic, interactive design inspired by the concept of a "torchlight." When users hover their cursor over the page, it will act as a virtual torchlight, illuminating sections of the homepage in a circular spotlight effect.

  • Background: A dark, textured canvas resembling a starry night sky.
  • Animation: Subtle glowing particles that react to the torchlight's movement, creating a sense of depth and interactivity.
  • Transitions: Smooth fade-ins and slide-ins for content as it enters the illuminated area.
  • Micro-interactions: Buttons and links will "sparkle" briefly when hovered over, reinforcing the torchlight theme.
  • Call-to-action: A central, glowing button labeled "Start Editing" that pulses gently to draw attention.

This design will create an unforgettable first impression, immersing users in the creative and innovative spirit of Mango-Torch.

7. Non-Functional Requirements

  • The system must support GPU acceleration for optimal performance.
  • The system should load the Stable Diffusion model within 5 seconds on a GPU-enabled device.
  • The UI must be responsive and accessible on both desktop and mobile devices.
  • The system should handle up to 50 concurrent users without performance degradation.
  • The system must comply with UAE data privacy regulations.

8. Tech Stack

Frontend

  • React for Web
  • React Native for Mobile App

Backend

  • Python
  • FastAPI

Database

  • MySQL (with Alembic for migrations)
Page 4 of 4

AI Models

  • Stable Diffusion (via Diffusers library)
  • GPT 5.4 for user-friendly responses

AI Tools

  • Litellm for LLM Routing
  • Langchain

Orchestration

  • Docker
  • Kubernetes

9. Assumptions and Constraints

  • The system assumes users have access to devices capable of running modern web browsers.
  • The system assumes GPU availability for optimal performance but will fall back to CPU if necessary.
  • The system is constrained by the computational limits of the hosting environment.

10. Glossary

  • Stable Diffusion: A deep learning model for generating and editing images based on textual prompts.
  • Gradio: A Python library for building interactive user interfaces.
  • CUDA: A parallel computing platform and application programming interface model created by Nvidia.
  • Torchlight Effect: A visual design concept where the cursor acts as a spotlight, illuminating parts of the page.
Landing design preview
Landing: View Intro
Editor: Upload Image
Editor: Enter Prompt
Editor: Adjust Parameters
Editor: Process Image
Results: Compare Images
Results: Download Output
BatchQueue: Upload Multiple