Spaces:
Sleeping
Sleeping
update app.py
Browse files
app.py
CHANGED
|
@@ -214,34 +214,17 @@ crypto_analysis_crew = Crew(
|
|
| 214 |
# ----------------------
|
| 215 |
|
| 216 |
def generate_report(crypto_name, currency, days):
|
| 217 |
-
import gradio as gr
|
| 218 |
-
|
| 219 |
crypto_inputs = {
|
| 220 |
"cryptocurrency_selection": crypto_name.lower(),
|
| 221 |
"currency_selection": currency.lower(),
|
| 222 |
"days_selection": int(days),
|
| 223 |
}
|
| 224 |
|
| 225 |
-
progress = gr.Progress(track_tqdm=False)
|
| 226 |
-
|
| 227 |
-
steps = [
|
| 228 |
-
"Fetching market data...",
|
| 229 |
-
"Fetching historical data...",
|
| 230 |
-
"Fetching sentiment...",
|
| 231 |
-
"Running analytics...",
|
| 232 |
-
"Generating trading strategy...",
|
| 233 |
-
"Producing final report..."
|
| 234 |
-
]
|
| 235 |
-
|
| 236 |
-
# Loop over progress stages
|
| 237 |
-
for i, message in enumerate(steps, start=1):
|
| 238 |
-
progress(i / len(steps), message)
|
| 239 |
-
|
| 240 |
result = crypto_analysis_crew.kickoff(inputs=crypto_inputs)
|
| 241 |
|
| 242 |
-
# Return final result
|
| 243 |
if isinstance(result, dict) and "final_output" in result:
|
| 244 |
return result["final_output"]
|
|
|
|
| 245 |
return str(result)
|
| 246 |
|
| 247 |
# ----------------------
|
|
@@ -250,7 +233,7 @@ def generate_report(crypto_name, currency, days):
|
|
| 250 |
|
| 251 |
with gr.Blocks(theme=gr.themes.Monochrome()) as app:
|
| 252 |
|
| 253 |
-
gr.Markdown("# πͺ Crypto Intelligence
|
| 254 |
gr.Markdown("Run a full multi-agent crypto analysis using structured JSON tools.")
|
| 255 |
|
| 256 |
with gr.Row():
|
|
@@ -269,12 +252,17 @@ with gr.Blocks(theme=gr.themes.Monochrome()) as app:
|
|
| 269 |
label="Historical Lookback (days)"
|
| 270 |
)
|
| 271 |
|
|
|
|
| 272 |
run_button = gr.Button("π Run Full Analysis", variant="primary")
|
|
|
|
| 273 |
report_output = gr.Markdown(label="π Intelligence Report")
|
| 274 |
|
| 275 |
run_button.click(
|
| 276 |
-
generate_report,
|
| 277 |
inputs=[crypto, currency, days],
|
| 278 |
outputs=report_output,
|
| 279 |
-
show_progress=True
|
| 280 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
# ----------------------
|
| 215 |
|
| 216 |
def generate_report(crypto_name, currency, days):
|
|
|
|
|
|
|
| 217 |
crypto_inputs = {
|
| 218 |
"cryptocurrency_selection": crypto_name.lower(),
|
| 219 |
"currency_selection": currency.lower(),
|
| 220 |
"days_selection": int(days),
|
| 221 |
}
|
| 222 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
result = crypto_analysis_crew.kickoff(inputs=crypto_inputs)
|
| 224 |
|
|
|
|
| 225 |
if isinstance(result, dict) and "final_output" in result:
|
| 226 |
return result["final_output"]
|
| 227 |
+
|
| 228 |
return str(result)
|
| 229 |
|
| 230 |
# ----------------------
|
|
|
|
| 233 |
|
| 234 |
with gr.Blocks(theme=gr.themes.Monochrome()) as app:
|
| 235 |
|
| 236 |
+
gr.Markdown("# πͺ Crypto Intelligence Dashboard")
|
| 237 |
gr.Markdown("Run a full multi-agent crypto analysis using structured JSON tools.")
|
| 238 |
|
| 239 |
with gr.Row():
|
|
|
|
| 252 |
label="Historical Lookback (days)"
|
| 253 |
)
|
| 254 |
|
| 255 |
+
# β original working button
|
| 256 |
run_button = gr.Button("π Run Full Analysis", variant="primary")
|
| 257 |
+
|
| 258 |
report_output = gr.Markdown(label="π Intelligence Report")
|
| 259 |
|
| 260 |
run_button.click(
|
| 261 |
+
fn=generate_report,
|
| 262 |
inputs=[crypto, currency, days],
|
| 263 |
outputs=report_output,
|
| 264 |
+
show_progress=True # this is fine; uses Gradioβs built-in indicator
|
| 265 |
+
)
|
| 266 |
+
|
| 267 |
+
if __name__ == "__main__":
|
| 268 |
+
app.launch(server_name="0.0.0.0", server_port=7860)
|