Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,31 +1,26 @@
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from
|
| 3 |
-
from byte_enforcer import enforce
|
| 4 |
-
from federation import package_for_federation
|
| 5 |
|
| 6 |
-
def
|
| 7 |
request = {
|
| 8 |
"commodity": commodity,
|
| 9 |
"physical_anchor": physical_anchor,
|
| 10 |
-
"
|
| 11 |
}
|
| 12 |
-
|
| 13 |
-
snapshot = economic_snapshot(request)
|
| 14 |
-
enforced = enforce(snapshot)
|
| 15 |
-
federated = package_for_federation(enforced)
|
| 16 |
-
|
| 17 |
-
return federated
|
| 18 |
|
| 19 |
demo = gr.Interface(
|
| 20 |
-
fn=
|
| 21 |
inputs=[
|
| 22 |
-
gr.Dropdown(["Gold", "Oil", "Copper"], label="Commodity"),
|
| 23 |
-
gr.Number(label="Physical Anchor"),
|
| 24 |
-
gr.Slider(0, 30, step=1, label="Reporting Lag (
|
| 25 |
],
|
| 26 |
-
outputs=gr.JSON(label="
|
| 27 |
-
title="
|
| 28 |
-
description="
|
| 29 |
)
|
| 30 |
|
| 31 |
if __name__ == "__main__":
|
|
|
|
| 1 |
+
# app.py
|
| 2 |
+
|
| 3 |
import gradio as gr
|
| 4 |
+
from api_endpoints import run_harmonization
|
|
|
|
|
|
|
| 5 |
|
| 6 |
+
def handle_submit(commodity, physical_anchor, reporting_lag):
|
| 7 |
request = {
|
| 8 |
"commodity": commodity,
|
| 9 |
"physical_anchor": physical_anchor,
|
| 10 |
+
"reporting_lag": reporting_lag
|
| 11 |
}
|
| 12 |
+
return run_harmonization(request)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
demo = gr.Interface(
|
| 15 |
+
fn=handle_submit,
|
| 16 |
inputs=[
|
| 17 |
+
gr.Dropdown(["Gold", "Iron Ore", "Oil", "Copper"], label="Commodity"),
|
| 18 |
+
gr.Number(value=950, label="Physical Anchor"),
|
| 19 |
+
gr.Slider(0, 30, step=1, label="Reporting Lag (days)")
|
| 20 |
],
|
| 21 |
+
outputs=gr.JSON(label="Result"),
|
| 22 |
+
title="CodexFlow ΩΞ • Economic Web Service",
|
| 23 |
+
description="Harmonized economic state + proof bundle"
|
| 24 |
)
|
| 25 |
|
| 26 |
if __name__ == "__main__":
|