Update app.py
Browse files
app.py
CHANGED
@@ -11,42 +11,4 @@ st.sidebar.image(
|
|
11 |
)
|
12 |
st.sidebar.markdown(
|
13 |
SIDE_BAR_TEXT
|
14 |
-
)
|
15 |
-
|
16 |
-
MAX_LEN = 100
|
17 |
-
|
18 |
-
max_length = st.sidebar.slider("Maximum generation length", 1, MAX_LEN, 20)
|
19 |
-
|
20 |
-
# TODO: use the correct URL once it is ready
|
21 |
-
# url = (
|
22 |
-
# f"https://hf.space/embed/bigscience/distributed-bloom-api/+/api/predict/"
|
23 |
-
# )
|
24 |
-
|
25 |
-
url = (
|
26 |
-
f"https://hf.space/embed/ybelkada/bloom-1b3-gen/+/api/predict/"
|
27 |
-
)
|
28 |
-
|
29 |
-
text_input = st.text_area(' Write your prompt below 🔎', height=50)
|
30 |
-
col1, col2, col3 = st.columns(3)
|
31 |
-
with col1:
|
32 |
-
button_pushed = st.button("Let's generate!")
|
33 |
-
with col2:
|
34 |
-
lucky_button = st.button("I am feeling lucky")
|
35 |
-
with col3:
|
36 |
-
method_button = st.button("How does the method work?")
|
37 |
-
|
38 |
-
text_placeholder = st.empty()
|
39 |
-
|
40 |
-
if lucky_button:
|
41 |
-
text_input = i_am_feeling_lucky()
|
42 |
-
button_pushed = True
|
43 |
-
|
44 |
-
if button_pushed:
|
45 |
-
if text_input != '':
|
46 |
-
r = requests.post(
|
47 |
-
url=url, json={"data": [text_input, max_length, 0.6, True, 5, 42]}
|
48 |
-
)
|
49 |
-
generated_text = r.json()["data"][0]
|
50 |
-
write_incremental(text_input + generated_text, text_placeholder)
|
51 |
-
else:
|
52 |
-
write_incremental("Write some text above and try again :-)", text_placeholder)
|
|
|
11 |
)
|
12 |
st.sidebar.markdown(
|
13 |
SIDE_BAR_TEXT
|
14 |
+
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|