Skip to content

Commit

Permalink
Revert
Browse files Browse the repository at this point in the history
  • Loading branch information
riku-02 committed May 19, 2022
1 parent de8506e commit 1c94578
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 54 deletions.
6 changes: 2 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import streamlit as st
from multiapp import MultiApp, MultiApp1
from multiapp import MultiApp
from app import home, create, custom
from PIL import Image, ImageDraw, ImageFont, ImageOps

app = MultiApp()
app1 = MultiApp1()


st.image('https://owo.whats-th.is/3pBJaga.png')
st.title('Text Logo Maker by Rikkuチャン')
Expand All @@ -13,8 +13,6 @@
app.add_app("Create", create.app)
app.add_app("Upload your Custom Design", custom.app)

app1.add_app1("Hehe", home.app)

# The main app
app.run()

51 changes: 1 addition & 50 deletions multiapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,53 +45,4 @@ def run(self):
self.apps,
format_func=lambda app: app['title'])

app['function']()


class MultiApp1:
"""Framework for combining multiple streamlit applications.
Usage:
def foo():
st.title("Hello Foo")
def bar():
st.title("Hello Bar")
app = MultiApp()
app.add_app("Foo", foo)
app.add_app("Bar", bar)
app.run()
It is also possible keep each application in a separate file.
import foo
import bar
app = MultiApp()
app.add_app("Foo", foo.app)
app.add_app("Bar", bar.app)
app.run()
"""

def __init__(self):
self.apps = []

def add_app1(self, title, func):
"""Adds a new application.
Parameters
----------
func:
the python function to render this app.
title:
title of the app. Appears in the dropdown in the sidebar.
"""
self.apps.append({
"title": title,
"function": func
})

def run(self):
# app = st.sidebar.radio(
app1 = st.sidebar.radio(
'[Navigation]',
self.apps,
format_func=lambda app1: app1['title'])

app1['function']()


app['function']()

0 comments on commit 1c94578

Please sign in to comment.