Spaces:
Runtime error
Runtime error
~drbenjamin
commited on
Commit
·
bbad637
1
Parent(s):
3d15ec6
added files
Browse files- pages/💁 Open_Assistant.py +19 -6
pages/💁 Open_Assistant.py
CHANGED
|
@@ -1,6 +1,9 @@
|
|
| 1 |
##### `💁 Open_Assistant.py`
|
|
|
|
| 2 |
##### https://huggingface.co/spaces/olivierdehaene/chat-llm-streaming/blob/main/README.md
|
| 3 |
-
##### https://
|
|
|
|
|
|
|
| 4 |
##### Please reach out to ben@benbox.org for any questions
|
| 5 |
#### Loading needed Python libraries
|
| 6 |
import streamlit as st
|
|
@@ -13,7 +16,7 @@ from text_generation import InferenceAPIClient
|
|
| 13 |
|
| 14 |
#### Streamlit initial setup
|
| 15 |
st.set_page_config(
|
| 16 |
-
page_title = "
|
| 17 |
page_icon = "images/OpenAssistant.png",
|
| 18 |
layout = "centered",
|
| 19 |
initial_sidebar_state = "expanded"
|
|
@@ -24,11 +27,21 @@ st.set_page_config(
|
|
| 24 |
|
| 25 |
#### Main program
|
| 26 |
st.header('💁 Open Assistant LLM')
|
|
|
|
|
|
|
| 27 |
st.write('This is the first iteration English supervised-fine-tuning (SFT) model of the Open-Assistant project. It is based on a Pythia 12B that was fine-tuned on ~22k human demonstrations of assistant conversations collected through the https://open-assistant.io/ human feedback web app before March 7, 2023.')
|
| 28 |
-
st.write('
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
st.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
# Token Streaming
|
| 34 |
#text = ""
|
|
|
|
| 1 |
##### `💁 Open_Assistant.py`
|
| 2 |
+
##### Chat Llm Streaming
|
| 3 |
##### https://huggingface.co/spaces/olivierdehaene/chat-llm-streaming/blob/main/README.md
|
| 4 |
+
##### https://open-assistant.io/dashboard
|
| 5 |
+
##### https://github.com/LAION-AI/Open-Assistant
|
| 6 |
+
|
| 7 |
##### Please reach out to ben@benbox.org for any questions
|
| 8 |
#### Loading needed Python libraries
|
| 9 |
import streamlit as st
|
|
|
|
| 16 |
|
| 17 |
#### Streamlit initial setup
|
| 18 |
st.set_page_config(
|
| 19 |
+
page_title = "💁 Open Assistant LLM",
|
| 20 |
page_icon = "images/OpenAssistant.png",
|
| 21 |
layout = "centered",
|
| 22 |
initial_sidebar_state = "expanded"
|
|
|
|
| 27 |
|
| 28 |
#### Main program
|
| 29 |
st.header('💁 Open Assistant LLM')
|
| 30 |
+
st.write('Conversational AI for everyone.')
|
| 31 |
+
st.write('In the same way that Stable Diffusion helped the world make art and images in new ways, this helps to improve the world by providing amazing conversational AI.')
|
| 32 |
st.write('This is the first iteration English supervised-fine-tuning (SFT) model of the Open-Assistant project. It is based on a Pythia 12B that was fine-tuned on ~22k human demonstrations of assistant conversations collected through the https://open-assistant.io/ human feedback web app before March 7, 2023.')
|
| 33 |
+
st.write(':orange[Needs to be run on Hugging Face to access the OpenAssistant model (Run it here https://huggingface.co/spaces/DrBenjamin/AI_Demo).]')
|
| 34 |
+
with st.form('OpenAssistant'):
|
| 35 |
+
client = InferenceAPIClient("OpenAssistant/oasst-sft-1-pythia-12b")
|
| 36 |
+
st.subheader('Question')
|
| 37 |
+
input_text = st.text_input('Ask a question')
|
| 38 |
+
input_text = '<|prompter|>' + input_text + '<|endoftext|><|assistant|>'
|
| 39 |
+
submitted = st.form_submit_button('Submit')
|
| 40 |
+
if submitted:
|
| 41 |
+
text = client.generate(input_text).generated_text
|
| 42 |
+
st.subheader('Answer')
|
| 43 |
+
st.write('Answer: :green[' + str(text) + ']')
|
| 44 |
+
|
| 45 |
|
| 46 |
# Token Streaming
|
| 47 |
#text = ""
|