Skip to content
TheChatArchiveThe Chat Archive
oasst-pythia-12b· LAION (OpenAssistant models)Hugging Face Arena Human Preference 55K

can you give a example with streamlit?

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with RWKVRWKV-4-Raven-14B’s answer.
  1. User

    can you give a example with streamlit?

  2. Assistant

    Sure! Here's an example of how to use Streamlit with a GPT-3 model:

    from streamlit import StreamlitApp
    from streamlit.ui import Text, Button
    
    app = StreamlitApp()
    
    @app.stream
    def gpt_3_stream(prompt):
        model = GPT3.from_pretrained("gpt-3-large")
        output = model(prompt)
        return output
    
    @app.button(text="Generate Text", button_type="secondary")
    def generate_text():
        prompt = Text("Generate text").render()
        response = gpt_3_stream(prompt)
        print(response)
    
    app.run(debug=True)
    

    This example uses the GPT3.from_pretrained function to load a pre-trained model and the gpt_3_stream function to generate text based on a prompt. The Button component is used to trigger the generate text action, and the Text component is used to render the prompt.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.