Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,17 +2,26 @@ import gradio as gr
|
|
| 2 |
from PIL import Image
|
| 3 |
from film_simulation import process_images
|
| 4 |
|
| 5 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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.Image(type="filepath", label="Input Image"),
|
| 15 |
-
gr.File(label="Profiles JSON"),
|
|
|
|
| 16 |
gr.Slider(0, 10, step=0.1, value=0, label="Chromatic Aberration Override"),
|
| 17 |
gr.Slider(0, 10, step=0.1, value=0, label="Blur Override"),
|
| 18 |
gr.Slider(1000, 10000, step=100, value=6500, label="Color Temperature (K)"),
|
|
@@ -38,3 +47,4 @@ iface = gr.Interface(
|
|
| 38 |
)
|
| 39 |
|
| 40 |
iface.launch()
|
|
|
|
|
|
| 2 |
from PIL import Image
|
| 3 |
from film_simulation import process_images
|
| 4 |
|
| 5 |
+
def load_default_profiles():
|
| 6 |
+
default_json_path = '12-film-profiles.json'
|
| 7 |
+
return load_film_profiles_from_json(default_json_path)
|
| 8 |
+
|
| 9 |
+
# Load default profiles to display in the dropdown
|
| 10 |
+
default_profiles = load_default_profiles()
|
| 11 |
+
profile_names = list(default_profiles.keys())
|
| 12 |
+
|
| 13 |
+
def gradio_interface(image, profiles_json, selected_profile, chroma_override, blur_override, color_temp, cross_process_flag, curve_type):
|
| 14 |
image = Image.open(image)
|
| 15 |
+
profiles_json_path = profiles_json.name if profiles_json else None
|
| 16 |
+
processed_images = process_images(image, profiles_json_path, selected_profile, chroma_override, blur_override, color_temp, cross_process_flag, curve_type)
|
| 17 |
return processed_images
|
| 18 |
|
| 19 |
iface = gr.Interface(
|
| 20 |
fn=gradio_interface,
|
| 21 |
inputs=[
|
| 22 |
gr.Image(type="filepath", label="Input Image"),
|
| 23 |
+
gr.File(label="Profiles JSON", optional=True),
|
| 24 |
+
gr.Dropdown(choices=["All"] + profile_names, value="All", label="Select Profile"),
|
| 25 |
gr.Slider(0, 10, step=0.1, value=0, label="Chromatic Aberration Override"),
|
| 26 |
gr.Slider(0, 10, step=0.1, value=0, label="Blur Override"),
|
| 27 |
gr.Slider(1000, 10000, step=100, value=6500, label="Color Temperature (K)"),
|
|
|
|
| 47 |
)
|
| 48 |
|
| 49 |
iface.launch()
|
| 50 |
+
|