Spaces:
Running
Running
File size: 1,828 Bytes
b5f6ee9 149436b b5f6ee9 149436b b5f6ee9 149436b b5f6ee9 149436b |
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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
import streamlit as st
from time import sleep
import os
from templates import *
# Page title
title = 'π¦π DemoGPT'
st.set_page_config(page_title=title)
st.title(title)
st.markdown(
"""
This's just to showcase the capabilities of DemoGPT.
For custom applications, please open in [](https://github.com/melih-unsal/DemoGPT)
"""
)
# Text input
openai_api_key = st.sidebar.text_input('OpenAI API Key', placeholder='sk-...',type="password")
demo_title = st.text_input('Enter your demo title', placeholder='Type your demo title')
st.write("Examples")
cols1 = st.columns([1,1,1.2])
cols2 = st.columns([1.6,1.5,1])
pid = None
pressed = False
if 'current' not in st.session_state:
st.session_state['current'] = ''
st.session_state['done'] = None
elif st.session_state['done']:
st.session_state['done'].empty()
for col,example in zip(cols1,examples1):
if col.button(example):
st.session_state['current'] = example
pressed = True
for col,example in zip(cols2,examples2):
if col.button(example):
st.session_state['current'] = example
pressed = True
st.markdown('----')
if st.session_state['current']:
with st.container():
if not openai_api_key.startswith('sk-'):
st.warning('Please enter your OpenAI API key!', icon='β ')
else:
if pressed and openai_api_key.startswith('sk-'):
wait()
st.session_state['done'] = st.success('Done!')
example2pages[st.session_state['current']](openai_api_key,demo_title)
st.markdown('----')
REPO_URL = "https://github.com/melih-unsal/DemoGPT"
st.markdown(f"Project [repo on github]({REPO_URL}) waiting for your :star:") |