Streamlit → FastAPI + Pydantic Converter

Paste your Streamlit app code → get production-ready FastAPI + HTML frontend in seconds!

Streamlit Code (Input)
FastAPI + HTML Code (Output)

            

About the Streamlit to FastAPI converter

Paste a simple Streamlit form and this tool writes a single-file FastAPI app that serves the same form as HTML. It uses the st.title text as the page heading. It turns st.text_input, st.text_area and st.selectbox calls into form fields, and adds a Pydantic model with one attribute per widget.

Example

Input: name = st.text_input("Your Name") and rating = st.selectbox("Rating", [1,2,3,4,5])

Output (excerpt):

class FormData(BaseModel):
    name: str
    rating: int
...
@app.post("/", response_class=HTMLResponse)
async def submit(request: Request):
    form = await request.form()

Limits

  • Only those three widget types are recognised. Charts, sliders, file uploads, session state and any logic between the widgets are not converted.
  • Every select box becomes an integer field with the options 1 to 5, whatever options your code lists. Edit the HTML to match.
  • The POST handler reads the form and returns a thank-you message. Write your own processing code there, and install python-multipart, which FastAPI needs to parse form data.
  • Run the result with uvicorn main:app --reload.

Privacy

All conversion happens in JavaScript inside your browser. The tool code on this page makes no network request with what you type, so your input is not uploaded or stored by PyInns. (The page itself still loads ads and shared libraries from third-party CDNs.)