File size: 1,502 Bytes
e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b 84d8880 e867d7b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
import marimo
__generated_with = "0.9.30"
app = marimo.App()
@app.cell
def __init():
import marimo as mo
from pyscribble import create
return create, mo
@app.cell
def __input_name(mo):
name = mo.ui.text(placeholder="Name...")
mo.md(
f"""
Enter the name of the guest: {name}
"""
)
return (name,)
@app.cell
def __input_function(mo):
options = ["tanh((-1+2j)*z)", "sinh(3*z)", "exp((-1+2j)*z)"]
dropdown = mo.ui.dropdown(options=options, value="sinh(3*z)")
mo.md(
f"""
Enter the complex function: {dropdown}
"""
)
return dropdown, options
@app.cell
def __input_event(mo):
event = mo.ui.text(placeholder="Event...")
mo.md(
f"""
Enter the name of the event: {event}
"""
)
return (event,)
@app.cell
def __output(create, dropdown, event, mo, name):
from io import BytesIO
fig = create(name=name.value, fct=dropdown.value, event=event.value, n=100)
img = fig.to_image(format="png")
# print(img)
data = BytesIO(img)
# Create a download button for the Plotly graph
download_btn = mo.download(
data=data,
filename=f"{name.value}_{event.value}_plot.png",
label="Download",
mimetype="image/png",
)
# Display the plot and download button
mo.md(
f"""
{download_btn}
{mo.ui.plotly(fig)}
"""
)
# return fig, download_btn
if __name__ == "__main__":
app.run()
|