Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -16,10 +16,17 @@ def get_number_of_profiles_and_labels(profiles_json):
|
|
| 16 |
profiles = default_profiles
|
| 17 |
return len(profiles), list(profiles.keys())
|
| 18 |
|
| 19 |
-
def gradio_interface(image, profiles_json, selected_profile,
|
| 20 |
image = Image.open(image)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
profiles_json_path = profiles_json.name if profiles_json else None
|
| 22 |
processed_images = process_images(image, profiles_json_path, selected_profile, chroma_override, blur_override, color_temp, cross_process_flag, curve_type)
|
|
|
|
| 23 |
output_images = []
|
| 24 |
for img in processed_images:
|
| 25 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmpfile:
|
|
@@ -38,9 +45,19 @@ iface = gr.Interface(
|
|
| 38 |
gr.Image(type="filepath", label="Input Image"),
|
| 39 |
gr.File(label="Profiles JSON"),
|
| 40 |
gr.Dropdown(choices=["All"] + profile_names, value="All", label="Select Profile"),
|
| 41 |
-
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
gr.Slider(1000, 10000, step=100, value=6500, label="Color Temperature (K)"),
|
|
|
|
| 44 |
gr.Checkbox(label="Cross Process"),
|
| 45 |
gr.Dropdown(choices=["color", "advanced", "both", "auto"], value="auto", label="Curve Type"),
|
| 46 |
],
|
|
|
|
| 16 |
profiles = default_profiles
|
| 17 |
return len(profiles), list(profiles.keys())
|
| 18 |
|
| 19 |
+
def gradio_interface(image, profiles_json, selected_profile, chroma_override_flag, chroma_override_value, blur_override_flag, blur_override_value, color_temp_flag, color_temp_value, cross_process_flag, curve_type):
|
| 20 |
image = Image.open(image)
|
| 21 |
+
|
| 22 |
+
# Override parameters based on checkbox state
|
| 23 |
+
chroma_override = chroma_override_value if chroma_override_flag else None
|
| 24 |
+
blur_override = blur_override_value if blur_override_flag else None
|
| 25 |
+
color_temp = color_temp_value if color_temp_flag else None
|
| 26 |
+
|
| 27 |
profiles_json_path = profiles_json.name if profiles_json else None
|
| 28 |
processed_images = process_images(image, profiles_json_path, selected_profile, chroma_override, blur_override, color_temp, cross_process_flag, curve_type)
|
| 29 |
+
|
| 30 |
output_images = []
|
| 31 |
for img in processed_images:
|
| 32 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".png") as tmpfile:
|
|
|
|
| 45 |
gr.Image(type="filepath", label="Input Image"),
|
| 46 |
gr.File(label="Profiles JSON"),
|
| 47 |
gr.Dropdown(choices=["All"] + profile_names, value="All", label="Select Profile"),
|
| 48 |
+
|
| 49 |
+
# Chromatic Aberration Override
|
| 50 |
+
gr.Checkbox(label="Override Chromatic Aberration"),
|
| 51 |
+
gr.Slider(0, 10, step=0.1, value=0, label="Chromatic Aberration Value"),
|
| 52 |
+
|
| 53 |
+
# Blur Override
|
| 54 |
+
gr.Checkbox(label="Override Blur"),
|
| 55 |
+
gr.Slider(0, 10, step=0.1, value=0, label="Blur Value"),
|
| 56 |
+
|
| 57 |
+
# Color Temperature Override
|
| 58 |
+
gr.Checkbox(label="Override Color Temperature"),
|
| 59 |
gr.Slider(1000, 10000, step=100, value=6500, label="Color Temperature (K)"),
|
| 60 |
+
|
| 61 |
gr.Checkbox(label="Cross Process"),
|
| 62 |
gr.Dropdown(choices=["color", "advanced", "both", "auto"], value="auto", label="Curve Type"),
|
| 63 |
],
|