-
Notifications
You must be signed in to change notification settings - Fork 0
/
space.py
52 lines (38 loc) · 1.62 KB
/
space.py
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
import streamlit as st
# Set up the page layout
st.set_page_config(
page_title="Burmese GPT",
page_icon=":speech_balloon:",
layout="wide"
)
# Create a sidebar with a title and a brief description
st.sidebar.title("Burmese GPT")
st.sidebar.write("A language model app for generating and chatting in Burmese.")
# Create a selectbox to choose the view
view_options = ["Sampling", "Chat Interface"]
selected_view = st.sidebar.selectbox("Select a view:", view_options)
# Create a main area
if selected_view == "Sampling":
st.title("Sampling")
st.write("Generate text using the pre-trained model:")
# Create a text input field for the prompt
prompt = st.text_input("Prompt:", value="")
# Create a slider to choose the temperature
temperature = st.slider("Temperature:", min_value=0.0, max_value=1.0, value=0.5)
# Create a button to generate text
generate_button = st.button("Generate")
# Create an output area to display the generated text
output_area = st.text_area("Generated Text:", height=200, disabled=True)
# Add some space between the input and output areas
st.write("")
elif selected_view == "Chat Interface":
st.title("Chat Interface")
st.write("Chat with the fine-tuned model:")
# Create a text input field for the user input
user_input = st.text_input("You:", value="")
# Create a button to send the input to the model
send_button = st.button("Send")
# Create an output area to display the model's response
response_area = st.text_area("Model:", height=200, disabled=True)
# Add some space between the input and output areas
st.write("")