Download app.py from Chemically-motivated/OSINT_Tool: direct link, hf CLI and curl.
- Browser
- Download file 2.22 kB
-
https://huggingface.co/spaces/Chemically-motivated/OSINT_Tool/resolve/4fa8602b46268e5a56c3f17066da521aed7b2820/app.py
- Command line
-
hf download hf://spaces/Chemically-motivated/OSINT_Tool@4fa8602b46268e5a56c3f17066da521aed7b2820/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Chemically-motivated/OSINT_Tool/resolve/4fa8602b46268e5a56c3f17066da521aed7b2820/app.py
2.22 kB
| import streamlit as st | |
| import requests | |
| from src.github_analysis import analyze_github_repo | |
| from src.url_fetcher import fetch_url_title | |
| from src.fine_tune_helpers import fine_tune_model | |
| # Title and description | |
| st.title("OSINT Tool 🏢") | |
| st.markdown(""" | |
| This tool performs **Open Source Intelligence (OSINT)** analysis on GitHub repositories and fetches titles from URLs. | |
| It also allows uploading datasets (CSV format) for fine-tuning models like **DistilBERT**. | |
| """) | |
| # Sidebar for navigation | |
| st.sidebar.title("Navigation") | |
| app_mode = st.sidebar.radio("Choose the mode", ["GitHub Repository Analysis", "URL Title Fetcher", "Dataset Upload & Fine-Tuning"]) | |
| # GitHub Repository Analysis | |
| if app_mode == "GitHub Repository Analysis": | |
| st.header("GitHub Repository Analysis") | |
| repo_owner = st.text_input("Enter GitHub Repository Owner", "huggingface") | |
| repo_name = st.text_input("Enter GitHub Repository Name", "transformers") | |
| if st.button("Analyze Repository"): | |
| if repo_owner and repo_name: | |
| repo_data = analyze_github_repo(repo_owner, repo_name) | |
| if repo_data: | |
| st.subheader("Repository Details") | |
| for key, value in repo_data.items(): | |
| st.write(f"**{key}**: {value}") | |
| else: | |
| st.error("Failed to retrieve repository details.") | |
| else: | |
| st.warning("Please enter both repository owner and name.") | |
| # URL Title Fetcher | |
| elif app_mode == "URL Title Fetcher": | |
| st.header("URL Title Fetcher") | |
| url = st.text_input("Enter URL", "https://www.huggingface.co") | |
| if st.button("Fetch Title"): | |
| if url: | |
| title = fetch_url_title(url) | |
| if title: | |
| st.write(f"**Page Title**: {title}") | |
| else: | |
| st.error("Failed to retrieve the page title.") | |
| else: | |
| st.warning("Please enter a valid URL.") | |
| # Dataset Upload & Fine-Tuning | |
| elif app_mode == "Dataset Upload & Fine-Tuning": | |
| st.header("Dataset Upload & Fine-Tuning") | |
| uploaded_file = st.file_uploader("Upload a CSV file for fine-tuning", type="csv") | |
| if uploaded_file is not None: | |
| fine_tune_model(uploaded_file) | |