Max KHANOV
commited on
Commit
·
3738039
1
Parent(s):
84afd0d
Fixed initial slider values and error messages
Browse files
app.py
CHANGED
@@ -7,16 +7,21 @@ with col1:
|
|
7 |
text = st.text_area('Enter text', "", height=180)
|
8 |
|
9 |
with col2:
|
10 |
-
weight = st.slider('weight', 0.0, 1.5, 0.01)
|
11 |
-
k = st.slider("k", 2, 10, 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 |
-
|
|
|
|
|
|
|
|
|
22 |
st.write(result)
|
|
|
|
7 |
text = st.text_area('Enter text', "", height=180)
|
8 |
|
9 |
with col2:
|
10 |
+
weight = st.slider('weight', min_value=0.0, max_value=3.0, value=1.5, step=0.01)
|
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://edfa-128-105-19-70.ngrok-free.app"
|
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
|
23 |
+
result = req.text
|
24 |
+
else:
|
25 |
+
result = "Sorry, an error occured!"
|
26 |
st.write(result)
|
27 |
+
|