Spaces:
Sleeping
Sleeping
| import gradio as gr | |
| import cv2 | |
| from inference import ( | |
| generate_grade, | |
| apply_grade | |
| ) | |
| def run(img): | |
| input_path="_gradio_input.jpg" | |
| cv2.imwrite( | |
| input_path, | |
| cv2.cvtColor( | |
| img, | |
| cv2.COLOR_RGB2BGR | |
| ) | |
| ) | |
| grade=generate_grade( | |
| input_path | |
| ) | |
| output=apply_grade( | |
| input_path, | |
| grade | |
| ) | |
| return cv2.cvtColor( | |
| output, | |
| cv2.COLOR_BGR2RGB | |
| ) | |
| demo=gr.Interface( | |
| fn=run, | |
| inputs=gr.Image(type="numpy"), | |
| outputs=gr.Image(), | |
| title="Contrastive Color Grade AI", | |
| examples=[ | |
| ["input.jpg"], | |
| ["input2.jpg"] | |
| ] | |
| ) | |
| demo.launch() | |