# This Gradio app allows users to add text to an image with customizable text color, size, and position. | |
import gradio as gr | |
import numpy as np | |
import matplotlib.pyplot as plt | |
from matplotlib.offsetbox import OffsetImage, AnnotationBbox | |
import io | |
# Define the function to add text to the image | |
def add_text_to_image(image, text, text_color, text_size, text_position_x, text_position_y, font): | |
# Convert the image to a format that can be manipulated | |
fig, ax = plt.subplots() | |
ax.imshow(image) | |
# Determine the position of the text | |
x, y = text_position_x |