Spaces:
Running
Running
File size: 846 Bytes
606f449 74cb225 |
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 |
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
|