Spaces:
Running
Running
Update Gradio app with multiple files
Browse files
config.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
# Define a custom theme based on Soft theme for a modern/Apple aesthetic
|
| 4 |
-
# Using
|
| 5 |
APPLE_TENCENT_THEME = gr.themes.Soft(
|
| 6 |
-
primary_hue=gr.themes.colors.
|
| 7 |
-
secondary_hue=gr.themes.colors.
|
| 8 |
-
neutral_hue=gr.themes.colors.
|
| 9 |
spacing_size=gr.themes.sizes.spacing_lg,
|
| 10 |
radius_size=gr.themes.sizes.radius_lg,
|
| 11 |
text_size=gr.themes.sizes.text_md,
|
| 12 |
).set(
|
| 13 |
-
# Custom tweaks for a cleaner, high-contrast look
|
| 14 |
body_background_fill="#F9F9F9",
|
| 15 |
background_fill_primary="#FFFFFF",
|
| 16 |
background_fill_secondary="#F0F0F0",
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
# Define a custom theme based on Soft theme for a modern/Apple aesthetic
|
| 4 |
+
# Using indigo for a deep tech blue (Tencent blue approximation)
|
| 5 |
APPLE_TENCENT_THEME = gr.themes.Soft(
|
| 6 |
+
primary_hue=gr.themes.colors.indigo, # FIX: Corrected capitalization to lowercase 'indigo'
|
| 7 |
+
secondary_hue=gr.themes.colors.gray,
|
| 8 |
+
neutral_hue=gr.themes.colors.neutral,
|
| 9 |
spacing_size=gr.themes.sizes.spacing_lg,
|
| 10 |
radius_size=gr.themes.sizes.radius_lg,
|
| 11 |
text_size=gr.themes.sizes.text_md,
|
| 12 |
).set(
|
| 13 |
+
# Custom tweaks for a cleaner, high-contrast look (Apple/Modern aesthetic)
|
| 14 |
body_background_fill="#F9F9F9",
|
| 15 |
background_fill_primary="#FFFFFF",
|
| 16 |
background_fill_secondary="#F0F0F0",
|
models.py
CHANGED
|
@@ -19,6 +19,7 @@ CLIENT: Union[InferenceClient, None] = None
|
|
| 19 |
|
| 20 |
if HF_TOKEN:
|
| 21 |
try:
|
|
|
|
| 22 |
CLIENT = InferenceClient(
|
| 23 |
provider=PROVIDER,
|
| 24 |
api_key=HF_TOKEN,
|
|
@@ -52,7 +53,6 @@ def generate_image(prompt: str) -> Image.Image:
|
|
| 52 |
return image
|
| 53 |
except Exception as e:
|
| 54 |
print(f"Error during image generation: {e}")
|
| 55 |
-
# Check for common API errors
|
| 56 |
if "Authentication failed" in str(e):
|
| 57 |
raise gr.Error("Authentication failed. Check your HF_TOKEN.")
|
| 58 |
if "limit reached" in str(e) or "quota" in str(e):
|
|
|
|
| 19 |
|
| 20 |
if HF_TOKEN:
|
| 21 |
try:
|
| 22 |
+
# Note: FAL AI provider uses HF_TOKEN as its api_key
|
| 23 |
CLIENT = InferenceClient(
|
| 24 |
provider=PROVIDER,
|
| 25 |
api_key=HF_TOKEN,
|
|
|
|
| 53 |
return image
|
| 54 |
except Exception as e:
|
| 55 |
print(f"Error during image generation: {e}")
|
|
|
|
| 56 |
if "Authentication failed" in str(e):
|
| 57 |
raise gr.Error("Authentication failed. Check your HF_TOKEN.")
|
| 58 |
if "limit reached" in str(e) or "quota" in str(e):
|