Minstrel / app.py
sci-m-wang's picture
Update app.py
606f449 verified
raw
history blame contribute delete
846 Bytes
import os
os.system("pip install openai")
from showcases.generate import generate
from showcases.test import test
from models.openai import Generator
import streamlit as st
# os.system("pip install transformers")
# os.system("pip install outlines")
# os.system("pip install pydantic")
api_key = os.getenv("api_key")
base_url = os.getenv("base_url")
model_name = os.getenv("model_name")
if __name__ == "__main__":
state = st.session_state
if "generator" not in state:
state.generator = Generator(
api_key = api_key,
base_url = base_url
)
state.generator.set_model(model_name)
pass
if "page" not in state:
state.page = "generate"
pass
if state.page == "generate":
generate()
pass
elif state.page == "test":
test()
pass