Spaces:
Runtime error
Runtime error
added gradio app
Browse files- app.py +40 -0
- requirements.txt +7 -0
app.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from PIL import Image
|
| 3 |
+
from film_simulation import process_images
|
| 4 |
+
|
| 5 |
+
def gradio_interface(image, profiles_json, chroma_override, blur_override, color_temp, cross_process_flag, curve_type):
|
| 6 |
+
image = Image.open(image)
|
| 7 |
+
profiles_json_path = profiles_json.name
|
| 8 |
+
processed_images = process_images(image, profiles_json_path, chroma_override, blur_override, color_temp, cross_process_flag, curve_type)
|
| 9 |
+
return processed_images
|
| 10 |
+
|
| 11 |
+
iface = gr.Interface(
|
| 12 |
+
fn=gradio_interface,
|
| 13 |
+
inputs=[
|
| 14 |
+
gr.inputs.Image(type="file", label="Input Image"),
|
| 15 |
+
gr.inputs.File(label="Profiles JSON"),
|
| 16 |
+
gr.inputs.Slider(0, 10, step=0.1, default=None, label="Chromatic Aberration Override"),
|
| 17 |
+
gr.inputs.Slider(0, 10, step=0.1, default=None, label="Blur Override"),
|
| 18 |
+
gr.inputs.Slider(1000, 10000, step=100, default=6500, label="Color Temperature (K)"),
|
| 19 |
+
gr.inputs.Checkbox(label="Cross Process"),
|
| 20 |
+
gr.inputs.Dropdown(choices=["color", "advanced", "both", "auto"], default="auto", label="Curve Type"),
|
| 21 |
+
],
|
| 22 |
+
outputs=[
|
| 23 |
+
gr.outputs.Image(type="pil", label="Processed Image 1"),
|
| 24 |
+
gr.outputs.Image(type="pil", label="Processed Image 2"),
|
| 25 |
+
gr.outputs.Image(type="pil", label="Processed Image 3"),
|
| 26 |
+
gr.outputs.Image(type="pil", label="Processed Image 4"),
|
| 27 |
+
gr.outputs.Image(type="pil", label="Processed Image 5"),
|
| 28 |
+
gr.outputs.Image(type="pil", label="Processed Image 6"),
|
| 29 |
+
gr.outputs.Image(type="pil", label="Processed Image 7"),
|
| 30 |
+
gr.outputs.Image(type="pil", label="Processed Image 8"),
|
| 31 |
+
gr.outputs.Image(type="pil", label="Processed Image 9"),
|
| 32 |
+
gr.outputs.Image(type="pil", label="Processed Image 10"),
|
| 33 |
+
gr.outputs.Image(type="pil", label="Processed Image 11"),
|
| 34 |
+
gr.outputs.Image(type="pil", label="Processed Image 12"),
|
| 35 |
+
],
|
| 36 |
+
title="Film Simulation",
|
| 37 |
+
description="Upload an image and a JSON file with film profiles to apply different film simulations."
|
| 38 |
+
)
|
| 39 |
+
|
| 40 |
+
iface.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
numpy
|
| 3 |
+
Pillow
|
| 4 |
+
colour-science
|
| 5 |
+
scipy
|
| 6 |
+
piexif
|
| 7 |
+
psutil
|