Spaces:
Sleeping
Sleeping
Commit
Β·
d871be8
1
Parent(s):
074e8ce
Fix Gradio 6 API compatibility
Browse files- Remove css parameter (not supported)
- Remove theme from Blocks() (use launch() instead)
- Remove show_copy_button (not in Gradio 6)
- Remove elem_classes and elem_id
π€ Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
app.py
CHANGED
|
@@ -105,39 +105,7 @@ def explain_topic(topic: str, persona_name: str, progress=gr.Progress()):
|
|
| 105 |
def create_app():
|
| 106 |
"""Create and configure the Gradio app."""
|
| 107 |
|
| 108 |
-
|
| 109 |
-
css = """
|
| 110 |
-
.gradio-container {
|
| 111 |
-
max-width: 900px !important;
|
| 112 |
-
margin: auto !important;
|
| 113 |
-
}
|
| 114 |
-
.persona-dropdown {
|
| 115 |
-
font-size: 1.1em !important;
|
| 116 |
-
}
|
| 117 |
-
#title-row {
|
| 118 |
-
text-align: center;
|
| 119 |
-
margin-bottom: 1rem;
|
| 120 |
-
}
|
| 121 |
-
.explanation-box {
|
| 122 |
-
font-size: 1.15em;
|
| 123 |
-
line-height: 1.6;
|
| 124 |
-
padding: 1rem;
|
| 125 |
-
background: linear-gradient(135deg, #667eea11 0%, #764ba211 100%);
|
| 126 |
-
border-radius: 10px;
|
| 127 |
-
}
|
| 128 |
-
.steps-accordion {
|
| 129 |
-
font-size: 0.95em;
|
| 130 |
-
}
|
| 131 |
-
"""
|
| 132 |
-
|
| 133 |
-
with gr.Blocks(
|
| 134 |
-
title="Explainor - AI Persona Explanations",
|
| 135 |
-
css=css,
|
| 136 |
-
theme=gr.themes.Soft(
|
| 137 |
-
primary_hue="violet",
|
| 138 |
-
secondary_hue="blue",
|
| 139 |
-
),
|
| 140 |
-
) as app:
|
| 141 |
# Header
|
| 142 |
gr.Markdown(
|
| 143 |
"""
|
|
@@ -147,8 +115,7 @@ def create_app():
|
|
| 147 |
|
| 148 |
Enter any topic and choose a persona. The AI will research your topic,
|
| 149 |
transform the explanation into that character's unique voice, and read it aloud.
|
| 150 |
-
"""
|
| 151 |
-
elem_id="title-row",
|
| 152 |
)
|
| 153 |
|
| 154 |
with gr.Row():
|
|
@@ -170,7 +137,6 @@ def create_app():
|
|
| 170 |
choices=persona_choices,
|
| 171 |
value=persona_choices[0],
|
| 172 |
label="π Choose your explainer",
|
| 173 |
-
elem_classes=["persona-dropdown"],
|
| 174 |
)
|
| 175 |
|
| 176 |
explain_btn = gr.Button(
|
|
@@ -186,8 +152,6 @@ def create_app():
|
|
| 186 |
label="π Explanation",
|
| 187 |
lines=8,
|
| 188 |
max_lines=15,
|
| 189 |
-
elem_classes=["explanation-box"],
|
| 190 |
-
show_copy_button=True,
|
| 191 |
)
|
| 192 |
|
| 193 |
audio_output = gr.Audio(
|
|
@@ -203,10 +167,7 @@ def create_app():
|
|
| 203 |
|
| 204 |
with gr.Column():
|
| 205 |
with gr.Accordion("π§ Agent Reasoning", open=False):
|
| 206 |
-
steps_output = gr.Markdown(
|
| 207 |
-
"",
|
| 208 |
-
elem_classes=["steps-accordion"],
|
| 209 |
-
)
|
| 210 |
|
| 211 |
# Example topics
|
| 212 |
gr.Examples(
|
|
@@ -231,8 +192,7 @@ def create_app():
|
|
| 231 |
Powered by: [Nebius AI](https://nebius.com) (LLM) + [ElevenLabs](https://elevenlabs.io) (TTS)
|
| 232 |
|
| 233 |
Made with β€οΈ by **kaiser-data**
|
| 234 |
-
"""
|
| 235 |
-
elem_id="footer",
|
| 236 |
)
|
| 237 |
|
| 238 |
# Event handler
|
|
|
|
| 105 |
def create_app():
|
| 106 |
"""Create and configure the Gradio app."""
|
| 107 |
|
| 108 |
+
with gr.Blocks(title="Explainor - AI Persona Explanations") as app:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
# Header
|
| 110 |
gr.Markdown(
|
| 111 |
"""
|
|
|
|
| 115 |
|
| 116 |
Enter any topic and choose a persona. The AI will research your topic,
|
| 117 |
transform the explanation into that character's unique voice, and read it aloud.
|
| 118 |
+
"""
|
|
|
|
| 119 |
)
|
| 120 |
|
| 121 |
with gr.Row():
|
|
|
|
| 137 |
choices=persona_choices,
|
| 138 |
value=persona_choices[0],
|
| 139 |
label="π Choose your explainer",
|
|
|
|
| 140 |
)
|
| 141 |
|
| 142 |
explain_btn = gr.Button(
|
|
|
|
| 152 |
label="π Explanation",
|
| 153 |
lines=8,
|
| 154 |
max_lines=15,
|
|
|
|
|
|
|
| 155 |
)
|
| 156 |
|
| 157 |
audio_output = gr.Audio(
|
|
|
|
| 167 |
|
| 168 |
with gr.Column():
|
| 169 |
with gr.Accordion("π§ Agent Reasoning", open=False):
|
| 170 |
+
steps_output = gr.Markdown("")
|
|
|
|
|
|
|
|
|
|
| 171 |
|
| 172 |
# Example topics
|
| 173 |
gr.Examples(
|
|
|
|
| 192 |
Powered by: [Nebius AI](https://nebius.com) (LLM) + [ElevenLabs](https://elevenlabs.io) (TTS)
|
| 193 |
|
| 194 |
Made with β€οΈ by **kaiser-data**
|
| 195 |
+
"""
|
|
|
|
| 196 |
)
|
| 197 |
|
| 198 |
# Event handler
|