Simple web publishing system

Hey everyone,

https://share.streamlit.io/kierancondon/stream

This app is an effort to share a simple web publishing system, enabled by Streamlit, which can display both text based and interactive code-based posts , which could be used for blogging, documentation etc…

Posts can be written in .md or .py files, including front matter to display a title, date, tags and contributing authors. Save your posts in a folder and then the app takes care of arranging and displaying all posts.

It’s a basic alternative to something like Jekyll + GitHub pages, with the interactive capabilities made possible by Streamlit.

Setting this up for your own project is easy. All code is within streamlit_app.py, and instructions shown on the app.

4 Likes

HEY @kierancondon,

Nice to see you here again! Well done on your app!

Happy Streamlit-ing!
Marisa

Very cool concept! Will be even cooler once streamlit supports nav bars to make it feel more like a blog. Keep up the good work!

1 Like

Hi - I had a need for this kind of thing recently and remembered I had bookmarked it a long time ago. I have it running and love it. Thanks!

The code in your gradient descent article (the last set of plots) needs to be fixed to work with the latest MPL library. Here’s the fix proposed by ChatGPT:

Summary

The error is due to the method gca() in Matplotlib’s Figure object. In recent versions of Matplotlib, gca() no longer accepts the projection='3d' keyword argument when invoked on a Figure instance directly. Instead, gca() is used for getting the current axes, and projection='3d' is only valid when creating a new 3D subplot using the add_subplot() or plt.subplot() methods.

To fix this issue, you should use add_subplot() with projection='3d' instead of gca():

fig1 = plt.figure()
ax = fig1.add_subplot(111, projection='3d')
ax.plot_surface(R, P, J_vals.T)
plt.plot(theta[t1], theta[t2], J_history[-1], 'rx', markersize=10)
plt.title('3D Cost Surface')
plt.xlabel('Variable ' + str(t1))
plt.ylabel('Variable ' + str(t2))
# plt.show()

fig2 = plt.figure()
plt.contour(R, P, J_vals.T)
plt.plot(theta[t1], theta[t2], 'rx', markersize=10)
plt.title('Cost Contour')
plt.xlabel('Variable ' + str(t1))
plt.ylabel('Variable ' + str(t2))
# plt.show()

fig3 = plt.figure()
ax = fig3.add_subplot(111, projection='3d')
plt.contour(R, P, J_vals.T)
plt.plot(theta[t1], theta[t2], J_history[-1], 'rx', markersize=10)
plt.title('3D Cost Contour')
plt.xlabel('Variable ' + str(t1))
plt.ylabel('Variable ' + str(t2))
# plt.show()

Explanation:

  • fig1.add_subplot(111, projection='3d') creates a 3D subplot in the fig1 figure.
  • The 111 indicates a single subplot (1 row, 1 column, 1st subplot).
  • The projection='3d' specifies that this is a 3D plot.

This modification ensures compatibility with recent versions of Matplotlib.