Spaces:
Sleeping
Sleeping
Download app.py from yearye/datasciencee: direct link, hf CLI and curl.
- Browser
- Download file 940 Bytes
-
https://huggingface.co/spaces/yearye/datasciencee/resolve/main/app.py
- Command line
-
hf download hf://spaces/yearye/datasciencee/app.py
-
curl -L -o app.py https://huggingface.co/spaces/yearye/datasciencee/resolve/main/app.py
940 Bytes
| import streamlit as st | |
| import pandas as pd | |
| import joblib | |
| from predict_module import extract_features_from_video_id, predict_view_count, visualize_result, predict_views | |
| api_key = "AIzaSyAgkZQp9EqA6N49J7TCh6Q40mWyVIGBit8" | |
| model = joblib.load("model/view_predictor.joblib") | |
| st.title("๐ฌ YouTube ์กฐํ์ ์์ธก๊ธฐ") | |
| video_id = st.text_input("YouTube ์์ ID๋ฅผ ์ ๋ ฅํ์ธ์:") | |
| if st.button("์์ธก ์์"): | |
| try: | |
| # โถ info = ์์ ์ ์ฒด ์ ๋ณด ํฌํจ | |
| info = predict_views(video_id, api_key) | |
| # โท features๋ง ์ถ์ถ | |
| features = extract_features_from_video_id(video_id, api_key) | |
| # โธ ์์ธก | |
| predicted = predict_view_count(model, features) | |
| # โน ์๊ฐํํ ๋ info๋ ๋๊น | |
| html = visualize_result(video_id, features, predicted, info) | |
| st.components.v1.html(html, height=1000) | |
| except Exception as e: | |
| st.error(f"โ ์ค๋ฅ ๋ฐ์: {e}") |