JuanPablo4to commited on
Commit
4375b6c
verified
1 Parent(s): 542771b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -1,4 +1,10 @@
1
  import streamlit as st
 
 
 
 
 
 
2
 
3
  # Display the logo and title
4
  st.image("logo.jpg", width=300)
@@ -24,11 +30,9 @@ for speaker, text in st.session_state['history']:
24
  user_input = st.chat_input("驴C贸mo te puedo ayudar hoy?")
25
  if user_input:
26
  with st.spinner("Generando respuesta..."):
27
- # Get the AI's response
28
- ai_response = llm.invoke(user_input, stop=['<|eot_id|>'])
29
-
30
  # Update the conversation history
31
  update_history(user_input, ai_response)
32
-
33
  # Display the AI's response
34
  st.write(ai_response)
 
1
  import streamlit as st
2
+ import transformers
3
+
4
+ # Replace "facebook/bart-base" with the desired LLM identifier from Hugging Face
5
+ model_name = "facebook/bart-base"
6
+ llm = transformers.pipeline("text-generation", model=model_name)
7
+
8
 
9
  # Display the logo and title
10
  st.image("logo.jpg", width=300)
 
30
  user_input = st.chat_input("驴C贸mo te puedo ayudar hoy?")
31
  if user_input:
32
  with st.spinner("Generando respuesta..."):
33
+ # Get the AI's response using the loaded llm object
34
+ ai_response = llm(user_input, max_length=1000, do_sample=True, top_k=50, top_p=0.9)["generated_text"][0]
 
35
  # Update the conversation history
36
  update_history(user_input, ai_response)
 
37
  # Display the AI's response
38
  st.write(ai_response)