Max KHANOV
commited on
Commit
·
37a687a
1
Parent(s):
913c08c
Added examples
Browse files
app.py
CHANGED
@@ -3,20 +3,27 @@ import streamlit as st
|
|
3 |
st.header('Args')
|
4 |
st.text('(Llama-7b sft)')
|
5 |
col1, col2 = st.columns([3,1])
|
|
|
|
|
6 |
with col1:
|
7 |
-
text = st.text_area('Enter text', "", height=180)
|
8 |
|
9 |
with col2:
|
10 |
-
weight = st.slider('weight', min_value=0.0, max_value=
|
11 |
k = st.slider("k", min_value=2, max_value=10, value=10, step=1)
|
12 |
|
13 |
trigger = st.button("Generate")
|
14 |
st.subheader("Result")
|
15 |
|
16 |
import requests
|
17 |
-
GROK_URL = "https://
|
18 |
ENDPOINT = f"{GROK_URL}/model"
|
19 |
|
|
|
|
|
|
|
|
|
|
|
20 |
if trigger:
|
21 |
req = requests.get(ENDPOINT, params={"weight": weight, "k": k, "text": text, "ngrok-skip-browser-warning": "1"})
|
22 |
if req.status_code == 200:
|
|
|
3 |
st.header('Args')
|
4 |
st.text('(Llama-7b sft)')
|
5 |
col1, col2 = st.columns([3,1])
|
6 |
+
|
7 |
+
example_num = st.selectbox("Select an example", ("None", "Example 1", "Example 2", "Example 3"))
|
8 |
with col1:
|
9 |
+
text = st.text_area('Enter text', "", height=180, key="text")
|
10 |
|
11 |
with col2:
|
12 |
+
weight = st.slider('weight', min_value=0.0, max_value=1.5, value=1.5, step=0.01)
|
13 |
k = st.slider("k", min_value=2, max_value=10, value=10, step=1)
|
14 |
|
15 |
trigger = st.button("Generate")
|
16 |
st.subheader("Result")
|
17 |
|
18 |
import requests
|
19 |
+
GROK_URL = "https://842f-128-105-19-70.ngrok-free.app"
|
20 |
ENDPOINT = f"{GROK_URL}/model"
|
21 |
|
22 |
+
if example_num != "None"
|
23 |
+
examples = {"Example 1": "What should you wear to a funeral?", "Example 2": "I need a good winter glove and I'm wondering what materials I should be looking for. I want something lightly insulated but weather resistant.", "Example 3": "My son is struggling to learn how to do addition. How can I teach him?"}
|
24 |
+
example_text = examples.get(example_num)
|
25 |
+
st.session_state.text = example_text
|
26 |
+
|
27 |
if trigger:
|
28 |
req = requests.get(ENDPOINT, params={"weight": weight, "k": k, "text": text, "ngrok-skip-browser-warning": "1"})
|
29 |
if req.status_code == 200:
|