pratikshahp commited on
Commit
da008a8
·
verified ·
1 Parent(s): 3ca400e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -17,7 +17,7 @@ llm = HuggingFaceEndpoint(
17
  huggingfacehub_api_token=HF_TOKEN.strip(),
18
  temperature=0.7,
19
  task="text-generation",
20
- max_new_tokens=200
21
  )
22
 
23
  # Initialize Streamlit app
@@ -46,8 +46,9 @@ if prompt := st.chat_input("Say something..."):
46
  history.add_user_message(prompt)
47
  st.chat_message("user").write(prompt)
48
 
49
- # Generate AI response
50
- response = conversation.predict(input=prompt)
 
51
 
52
  # Add AI message to history
53
  history.add_ai_message(response)
 
17
  huggingfacehub_api_token=HF_TOKEN.strip(),
18
  temperature=0.7,
19
  task="text-generation",
20
+ max_new_tokens=100
21
  )
22
 
23
  # Initialize Streamlit app
 
46
  history.add_user_message(prompt)
47
  st.chat_message("user").write(prompt)
48
 
49
+ # Generate AI response with word limit instruction
50
+ limited_prompt = f"{prompt}\n\nPlease respond in no more than 50 words."
51
+ response = conversation.predict(input=limited_prompt)
52
 
53
  # Add AI message to history
54
  history.add_ai_message(response)