Spaces:
Runtime error
Runtime error
File size: 924 Bytes
a877ce2 6585c68 a877ce2 616cb51 c30a851 616cb51 c30a851 6585c68 c30a851 6585c68 c30a851 a792e4a c30a851 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
import gradio as gr
import os
from colormap import rgb2hex
import pandas as pd
from flask import Flask, request, render_template_string
import math
import statistics
from statistics import mode
from PIL import Image
import extcolors
import cv2
import numpy as np
import fitz
import pypdfium2 as pdfium
def mouse_callback(event, x, y, flags, param):
if event == cv2.EVENT_LBUTTONDOWN:
print("Left button down at ({}, {})".format(x, y))
elif event == cv2.EVENT_RBUTTONDOWN:
print("Right button down at ({}, {})".format(x, y))
# Create a function to handle user input
def handle_image(image):
# Display the image
cv2.imshow("Image", image)
cv2.setMouseCallback("Image", mouse_callback)
cv2.waitKey(0)
cv2.destroyAllWindows()
# Define the Gradio interface without inputs
iface = gr.Interface(fn=handle_image, inputs=None, outputs="image")
# Launch the interface
iface.launch() |