Leonardo Parente commited on
Commit
69e7b7b
β€’
1 Parent(s): a5534b5

test tansformers

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -1,10 +1,17 @@
1
  import streamlit as st
2
  from langchain.memory import ConversationBufferMemory
3
  from langchain.memory.chat_message_histories import StreamlitChatMessageHistory
 
4
 
5
  msgs = StreamlitChatMessageHistory()
6
  memory = ConversationBufferMemory(memory_key="history", chat_memory=msgs)
7
 
 
 
 
 
 
 
8
  st.title("πŸͺ©πŸ€–")
9
 
10
  if len(msgs.messages) == 0:
 
1
  import streamlit as st
2
  from langchain.memory import ConversationBufferMemory
3
  from langchain.memory.chat_message_histories import StreamlitChatMessageHistory
4
+ from langchain.llms.huggingface_pipeline import HuggingFacePipeline
5
 
6
  msgs = StreamlitChatMessageHistory()
7
  memory = ConversationBufferMemory(memory_key="history", chat_memory=msgs)
8
 
9
+ hf = HuggingFacePipeline.from_model_id(
10
+ model_id="gpt2",
11
+ task="text-generation",
12
+ pipeline_kwargs={"max_new_tokens": 10},
13
+ )
14
+
15
  st.title("πŸͺ©πŸ€–")
16
 
17
  if len(msgs.messages) == 0: