File size: 2,224 Bytes
c954503
e511bc5
f13ce67
 
 
e511bc5
 
 
 
 
 
 
f13ce67
e511bc5
 
 
 
 
 
 
 
 
 
 
 
f13ce67
 
 
 
 
 
 
6a46dba
e511bc5
 
 
 
 
 
 
 
 
f13ce67
 
 
 
 
e511bc5
 
 
 
 
 
 
 
 
 
f13ce67
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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)