import streamlit as st import requests import re from transformers import AutoModelForSequenceClassification, AutoTokenizer import torch import pandas as pd from datasets import Dataset from huggingface_hub import hf_api # 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: try: response = requests.get(f"https://api.github.com/repos/{repo_owner}/{repo_name}") data = response.json() if response.status_code == 200: st.subheader("Repository Details") st.write(f"**Name**: {data['name']}") st.write(f"**Owner**: {data['owner']['login']}") st.write(f"**Stars**: {data['stargazers_count']}") st.write(f"**Forks**: {data['forks_count']}") st.write(f"**Language**: {data['language']}") st.write(f"**Description**: {data['description']}") else: st.error(f"Error: {data.get('message', 'Something went wrong with the request')}") except Exception as e: st.error(f"Error occurred: {e}") 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: try: response = requests.get(url) if response.status_code == 200: # Try to extract the title from the HTML match = re.search('