Download app.py from kjn1009/test0713: direct link, hf CLI and curl.
- Browser
- Download file 1.27 kB
-
https://huggingface.co/spaces/kjn1009/test0713/resolve/main/app.py
- Command line
-
hf download hf://spaces/kjn1009/test0713/app.py
-
curl -L -o app.py https://huggingface.co/spaces/kjn1009/test0713/resolve/main/app.py
1.27 kB
| import streamlit as st | |
| from transformers import pipeline | |
| from PIL import Image | |
| from utils import print_messages | |
| # pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog") | |
| st.set_page_config(page_title="Shim-Dot", page_icon="๐ค") | |
| st.title("๐ค Shim-Dot") | |
| # file_name = st.file_uploader("Upload a hot dog candidate image") | |
| '''if file_name is not None: | |
| col1, col2 = st.columns(2) | |
| image = Image.open(file_name) | |
| col1.image(image, use_column_width=True) | |
| predictions = pipeline(image) | |
| col2.header("Probabilities") | |
| for p in predictions: | |
| col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")''' | |
| if "messages" not in st.session_state: | |
| st.session_state["messages"] = [] | |
| # ์ด์ ๋ํ ์ถ๋ ฅ ์ฝ๋ | |
| print_messages() | |
| if user_input := st.chat_input("ํธํ๊ฒ ๋ง์ํด ๋ณด์ธ์."): | |
| # ์ฌ์ฉ์ ์ ๋ ฅ ๋ด์ฉ | |
| st.chat_message("user").write(f"{user_input}") | |
| #st.session_state["messages"].append(("user", user_input)) | |
| st.session_state["messages"].append(("user", user_input)) | |
| # AI ๋ต๋ณ | |
| with st.chat_message("assistant"): | |
| msg = f"๋น์ ์ด ์ ๋ ฅํ ๋ด์ฉ : {user_input}" | |
| st.write(msg) | |
| st.session_state["messages"].append(("assistant", msg)) | |