Spaces:
Sleeping
Sleeping
Download app.py from subhash33/llm_chat_models_1: direct link, hf CLI and curl.
- Browser
- Download file 588 Bytes
-
https://huggingface.co/spaces/subhash33/llm_chat_models_1/resolve/main/app.py
- Command line
-
hf download hf://spaces/subhash33/llm_chat_models_1/app.py
-
curl -L -o app.py https://huggingface.co/spaces/subhash33/llm_chat_models_1/resolve/main/app.py
588 Bytes
| import streamlit as st | |
| from langchain_huggingface import ChatHuggingFace, HuggingFacePipeline | |
| def load_llm(): | |
| llm = HuggingFacePipeline.from_model_id( | |
| model_id="TinyLlama/TinyLlama-1.1B-Chat-v1.0", | |
| task="text-generation", | |
| pipeline_kwargs=dict( | |
| temperature=0.5, | |
| max_new_tokens=150 | |
| ) | |
| ) | |
| return ChatHuggingFace(llm=llm) | |
| model=load_llm() | |
| st.header("QnA Tool") | |
| user_input = st.text_input("Enter your prompt") | |
| if st.button("Summarize"): | |
| result = model.invoke(user_input) | |
| st.write(result.content) |