3v324v23 commited on
Commit
a5054e7
·
0 Parent(s):

Deploy AI Resume Tailor

Browse files
Files changed (8) hide show
  1. .gitignore +120 -0
  2. Dockerfile +21 -0
  3. README.md +38 -0
  4. app.py +349 -0
  5. get-pip.py +0 -0
  6. requirements.txt +8 -0
  7. space.yaml +7 -0
  8. sttemlit_res.ipynb +433 -0
.gitignore ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Dependencies
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+ MANIFEST
23
+
24
+ # PyInstaller
25
+ *.manifest
26
+ *.spec
27
+
28
+ # Installer logs
29
+ pip-log.txt
30
+ pip-delete-this-directory.txt
31
+
32
+ # Unit test / coverage reports
33
+ htmlcov/
34
+ .tox/
35
+ .coverage
36
+ .coverage.*
37
+ .cache
38
+ nosetests.xml
39
+ coverage.xml
40
+ *.cover
41
+ .hypothesis/
42
+ .pytest_cache/
43
+
44
+ # Translations
45
+ *.mo
46
+ *.pot
47
+
48
+ # Django stuff:
49
+ *.log
50
+ local_settings.py
51
+ db.sqlite3
52
+ db.sqlite3-journal
53
+
54
+ # Flask stuff:
55
+ instance/
56
+ .webassets-cache
57
+
58
+ # Scrapy stuff:
59
+ .scrapy
60
+
61
+ # Sphinx documentation
62
+ docs/_build/
63
+
64
+ # PyBuilder
65
+ target/
66
+
67
+ # Jupyter Notebook
68
+ .ipynb_checkpoints
69
+
70
+ # pyenv
71
+ .python-version
72
+
73
+ # celery beat schedule file
74
+ celerybeat-schedule
75
+
76
+ # SageMath parsed files
77
+ *.sage.py
78
+
79
+ # Environments
80
+ .env
81
+ .venv
82
+ env/
83
+ venv/
84
+ ENV/
85
+ env.bak/
86
+ venv.bak/
87
+
88
+ # Spyder project settings
89
+ .spyderproject
90
+ .spyproject
91
+
92
+ # Rope project settings
93
+ .ropeproject
94
+
95
+ # mkdocs documentation
96
+ /site
97
+
98
+ # mypy
99
+ .mypy_cache/
100
+ .dmypy.json
101
+ dmypy.json
102
+
103
+ # Pyre type checker
104
+ .pyre/
105
+
106
+ # Generated files
107
+ generated_resumes/
108
+ *.docx
109
+ *.pdf
110
+
111
+ # IDE
112
+ .vscode/
113
+ .idea/
114
+ *.swp
115
+ *.swo
116
+ *~
117
+
118
+ # OS files
119
+ Thumbs.db
120
+ .DS_Store
Dockerfile ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.10-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Copy requirements file
6
+ COPY requirements.txt requirements.txt
7
+
8
+ # Install dependencies
9
+ RUN pip install --no-cache-dir -r requirements.txt
10
+
11
+ # Copy app files
12
+ COPY app.py app.py
13
+
14
+ # Create directory for generated files
15
+ RUN mkdir -p generated_resumes
16
+
17
+ # Expose port 7860 (default for Hugging Face Spaces)
18
+ EXPOSE 7860
19
+
20
+ # Run the app
21
+ CMD ["streamlit", "run", "app.py", "--server.port", "7860", "--server.address", "0.0.0.0"]
README.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AI Resume Tailor
2
+
3
+ A powerful AI-driven resume generator that creates professional resumes from job descriptions.
4
+
5
+ ## Features
6
+
7
+ - **AI-Powered Generation**: Uses state-of-the-art T5 model for resume generation
8
+ - **Multiple Formats**: Support for both Word and PDF formats
9
+ - **Customizable Templates**: Choose from professional resume templates
10
+ - **ATS Optimization**: Generated resumes are optimized for Applicant Tracking Systems
11
+
12
+ ## How to Use
13
+
14
+ 1. **Paste Job Description**: Enter the job description you're applying for
15
+ 2. **Add Personal Details**: Provide your name, email, phone number, and location
16
+ 3. **Generate Resume**: Click the "Generate Resume" button
17
+ 4. **Download**: Download your resume in Word or PDF format
18
+
19
+ ## Technology Stack
20
+
21
+ - **Streamlit**: Web application framework
22
+ - **PyTorch**: Deep learning framework
23
+ - **Transformers**: Hugging Face transformer models
24
+ - **python-docx**: Word document generation
25
+ - **ReportLab**: PDF generation
26
+ - **scikit-learn**: Text analysis
27
+
28
+ ## Deployment
29
+
30
+ This app is deployed on Hugging Face Spaces using Docker.
31
+
32
+ ## Local Development
33
+
34
+ To run locally:
35
+
36
+ ```bash
37
+ pip install -r requirements.txt
38
+ streamlit run app.py
app.py ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import torch
3
+ import json
4
+ import re
5
+ from transformers import AutoTokenizer, AutoModelForSeq2SeqLM
6
+ from docx import Document
7
+ from docx.shared import Pt, Inches
8
+ from docx.enum.text import WD_ALIGN_PARAGRAPH
9
+ from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer, Table, TableStyle, Frame, PageTemplate
10
+ from reportlab.lib.pagesizes import A4
11
+ from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
12
+ from reportlab.lib import colors
13
+ import os
14
+ import numpy as np
15
+ from sklearn.feature_extraction.text import TfidfVectorizer
16
+ from sklearn.metrics.pairwise import cosine_similarity
17
+
18
+ # =========================
19
+ # PAGE CONFIGURATION
20
+ # =========================
21
+ st.set_page_config(page_title="AI Resume Tailor", page_icon="📄", layout="wide")
22
+
23
+ # =========================
24
+ # LOAD AI MODEL
25
+ # =========================
26
+ model_name = "nakamoto-yama/t5-resume-generation"
27
+ device = "cuda" if torch.cuda.is_available() else "cpu"
28
+
29
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
30
+ model = AutoModelForSeq2SeqLM.from_pretrained(model_name, low_cpu_mem_usage=True)
31
+ if device == "cuda":
32
+ model = model.cuda()
33
+
34
+ # =========================
35
+ # HELPER FUNCTIONS
36
+ # =========================
37
+
38
+ def generate_response(input_text):
39
+ """Generate AI response from the model with proper token length handling"""
40
+ # Truncate input to fit within model's maximum token length
41
+ max_input_length = 512 - 20 # Leave room for "generate: " prefix and padding
42
+ if len(input_text) > max_input_length:
43
+ input_text = input_text[:max_input_length]
44
+
45
+ inputs = tokenizer.encode("generate: " + input_text, return_tensors="pt").to(device)
46
+
47
+ with torch.no_grad():
48
+ outputs = model.generate(
49
+ inputs,
50
+ max_length=512,
51
+ num_beams=4,
52
+ early_stopping=True,
53
+ do_sample=True,
54
+ temperature=0.7
55
+ )
56
+
57
+ return tokenizer.decode(outputs[0], skip_special_tokens=True)
58
+
59
+ def calculate_similarity(text1, text2):
60
+ """Calculate cosine similarity between two texts using TF-IDF"""
61
+ vectorizer = TfidfVectorizer()
62
+ tfidf_matrix = vectorizer.fit_transform([text1, text2])
63
+ similarity_score = cosine_similarity(tfidf_matrix[0:1], tfidf_matrix[1:2])[0][0]
64
+ return round(similarity_score * 100, 2)
65
+
66
+ def extract_keywords(text, top_n=10):
67
+ """Extract top keywords from text using TF-IDF"""
68
+ vectorizer = TfidfVectorizer(stop_words='english', ngram_range=(1, 2))
69
+ tfidf_matrix = vectorizer.fit_transform([text])
70
+ scores = tfidf_matrix.toarray()[0]
71
+ keywords = vectorizer.get_feature_names_out()
72
+ keyword_scores = sorted(list(zip(keywords, scores)), key=lambda x: x[1], reverse=True)
73
+
74
+ return [keyword for keyword, score in keyword_scores[:top_n]]
75
+
76
+ def analyze_resume_job_match(resume_text, job_description):
77
+ """Analyze resume against job description and provide detailed comparison"""
78
+ # Calculate overall similarity score
79
+ overall_score = calculate_similarity(resume_text, job_description)
80
+
81
+ # Extract keywords from both
82
+ resume_keywords = extract_keywords(resume_text)
83
+ job_keywords = extract_keywords(job_description)
84
+
85
+ # Find matching and missing keywords
86
+ matching_keywords = [keyword for keyword in resume_keywords if keyword in job_keywords]
87
+ missing_keywords = [keyword for keyword in job_keywords if keyword not in resume_keywords]
88
+
89
+ # Generate improvement suggestions
90
+ prompt = f"""Analyze the resume and job description below and provide specific suggestions for improvement:
91
+
92
+ RESUME:
93
+ {resume_text}
94
+
95
+ JOB DESCRIPTION:
96
+ {job_description}
97
+
98
+ Focus on:
99
+ 1. Skills and qualifications matching
100
+ 2. Experience relevance
101
+ 3. Keywords optimization
102
+ 4. Structure and formatting
103
+ 5. Quantifiable achievements
104
+
105
+ Provide clear, actionable suggestions in numbered format."""
106
+
107
+ try:
108
+ suggestions = generate_response(prompt)
109
+ except Exception as e:
110
+ suggestions = f"Error generating suggestions: {str(e)}"
111
+
112
+ # Create detailed analysis
113
+ analysis = {
114
+ "overall_score": overall_score,
115
+ "resume_keywords": resume_keywords,
116
+ "job_keywords": job_keywords,
117
+ "matching_keywords": matching_keywords,
118
+ "missing_keywords": missing_keywords,
119
+ "suggestions": suggestions
120
+ }
121
+
122
+ return analysis
123
+
124
+ def create_word_analysis_report(analysis, resume_text, job_description, filename="resume_analysis.docx"):
125
+ """Create a Word document with resume-job description analysis"""
126
+ doc = Document()
127
+
128
+ # Set document properties
129
+ section = doc.sections[0]
130
+ section.top_margin = Inches(0.5)
131
+ section.bottom_margin = Inches(0.5)
132
+ section.left_margin = Inches(0.75)
133
+ section.right_margin = Inches(0.75)
134
+
135
+ # Title
136
+ title = doc.add_heading("Resume-Job Description Analysis", 0)
137
+ title.alignment = WD_ALIGN_PARAGRAPH.CENTER
138
+
139
+ doc.add_paragraph()
140
+
141
+ # Overall Score
142
+ score_paragraph = doc.add_paragraph()
143
+ score_paragraph.alignment = WD_ALIGN_PARAGRAPH.CENTER
144
+ run = score_paragraph.add_run(f"Overall Match Score: {analysis['overall_score']}/100")
145
+ run.font.size = Pt(14)
146
+ run.bold = True
147
+
148
+ doc.add_paragraph()
149
+
150
+ # Resume vs Job Description
151
+ doc.add_heading("1. Resume vs Job Description", level=1)
152
+
153
+ col1 = doc.add_paragraph()
154
+ run = col1.add_run("Resume Keywords: ")
155
+ run.bold = True
156
+ col1.add_run(", ".join(analysis['resume_keywords']))
157
+
158
+ col2 = doc.add_paragraph()
159
+ run = col2.add_run("Job Description Keywords: ")
160
+ run.bold = True
161
+ col2.add_run(", ".join(analysis['job_keywords']))
162
+
163
+ doc.add_paragraph()
164
+
165
+ # Matching and Missing Keywords
166
+ doc.add_heading("2. Keyword Analysis", level=1)
167
+
168
+ match_para = doc.add_paragraph()
169
+ run = match_para.add_run("Matching Keywords: ")
170
+ run.bold = True
171
+ match_para.add_run(", ".join(analysis['matching_keywords']))
172
+
173
+ missing_para = doc.add_paragraph()
174
+ run = missing_para.add_run("Missing Keywords: ")
175
+ run.bold = True
176
+ missing_para.add_run(", ".join(analysis['missing_keywords']))
177
+
178
+ doc.add_paragraph()
179
+
180
+ # Improvement Suggestions
181
+ doc.add_heading("3. Improvement Suggestions", level=1)
182
+ p = doc.add_paragraph(analysis['suggestions'])
183
+ p.paragraph_format.line_spacing = 1.5
184
+
185
+ doc.add_paragraph()
186
+
187
+ # Original Documents
188
+ doc.add_heading("4. Original Resume", level=1)
189
+ p = doc.add_paragraph(resume_text)
190
+ p.paragraph_format.line_spacing = 1.5
191
+
192
+ doc.add_paragraph()
193
+
194
+ doc.add_heading("5. Job Description", level=1)
195
+ p = doc.add_paragraph(job_description)
196
+ p.paragraph_format.line_spacing = 1.5
197
+
198
+ doc.save(filename)
199
+ return filename
200
+
201
+ def format_analysis_as_json(analysis, resume_text, job_description):
202
+ """Format analysis results as JSON"""
203
+ return json.dumps({
204
+ "analysis": analysis,
205
+ "original_resume": resume_text,
206
+ "job_description": job_description
207
+ }, indent=2)
208
+
209
+ # =========================
210
+ # STREAMLIT INTERFACE
211
+ # =========================
212
+
213
+ def main():
214
+ st.title("📄 AI Resume Tailor")
215
+ st.write(f"Using device: {device}")
216
+
217
+ st.markdown("""
218
+ **Resume-Job Description Matching and Analysis Tool**
219
+
220
+ This application analyzes your resume against job descriptions, provides a match score,
221
+ identifies key improvements, and generates tailored suggestions.
222
+ """)
223
+
224
+ # Input Sections
225
+ col1, col2 = st.columns([2, 1])
226
+
227
+ with col1:
228
+ st.subheader("1. Job Description")
229
+ job_description = st.text_area(
230
+ "Paste the job description here",
231
+ height=300,
232
+ help="The more detailed the job description, the better the analysis"
233
+ )
234
+
235
+ with col2:
236
+ st.subheader("2. Your Resume")
237
+ current_resume = st.text_area(
238
+ "Paste your resume here",
239
+ height=300,
240
+ help="Your current resume for analysis"
241
+ )
242
+
243
+ # Analyze Button
244
+ if st.button("Analyze and Tailor Resume", type="primary", use_container_width=True):
245
+ if not job_description.strip() or not current_resume.strip():
246
+ st.error("Please paste both job description and resume")
247
+ else:
248
+ with st.spinner("Analyzing your resume against the job description..."):
249
+ try:
250
+ # Analyze resume-job match
251
+ analysis = analyze_resume_job_match(current_resume, job_description)
252
+
253
+ st.success("✅ Analysis completed successfully!")
254
+
255
+ # Display Overall Score
256
+ st.subheader(f"🎯 Match Score: {analysis['overall_score']}/100")
257
+
258
+ # Progress bar
259
+ st.progress(analysis['overall_score'] / 100)
260
+
261
+ # Display Results
262
+ st.subheader("📊 Detailed Analysis")
263
+
264
+ # Keywords Analysis
265
+ with st.expander("Keywords Analysis", expanded=True):
266
+ col_key1, col_key2 = st.columns(2)
267
+
268
+ with col_key1:
269
+ st.markdown("### Resume Keywords")
270
+ st.write(", ".join(analysis['resume_keywords']))
271
+
272
+ with col_key2:
273
+ st.markdown("### Job Description Keywords")
274
+ st.write(", ".join(analysis['job_keywords']))
275
+
276
+ # Matching and Missing Keywords
277
+ with st.expander("Matching & Missing Keywords", expanded=True):
278
+ col_match1, col_match2 = st.columns(2)
279
+
280
+ with col_match1:
281
+ st.markdown("### ✅ Matching Keywords")
282
+ st.write(", ".join(analysis['matching_keywords']))
283
+
284
+ with col_match2:
285
+ st.markdown("### ❌ Missing Keywords")
286
+ st.write(", ".join(analysis['missing_keywords']))
287
+
288
+ # Improvement Suggestions
289
+ st.subheader("🚀 Improvement Suggestions")
290
+ st.info(analysis['suggestions'])
291
+
292
+ # Download Options
293
+ st.subheader("📥 Download Options")
294
+ col_download1, col_download2 = st.columns(2)
295
+
296
+ with col_download1:
297
+ # JSON Download
298
+ json_data = format_analysis_as_json(analysis, current_resume, job_description)
299
+ st.download_button(
300
+ "📄 Download as JSON",
301
+ json_data,
302
+ file_name="resume_analysis.json",
303
+ mime="application/json"
304
+ )
305
+
306
+ with col_download2:
307
+ # Word Document Download
308
+ word_filename = create_word_analysis_report(analysis, current_resume, job_description)
309
+ with open(word_filename, "rb") as f:
310
+ st.download_button(
311
+ "📄 Download as Word Document",
312
+ f,
313
+ file_name="resume_analysis.docx",
314
+ mime="application/vnd.openxmlformats-officedocument.wordprocessingml.document"
315
+ )
316
+ os.remove(word_filename)
317
+
318
+ except Exception as e:
319
+ st.error(f"Error analyzing resume: {str(e)}")
320
+ st.error("Please try again with a different input or check your internet connection.")
321
+
322
+ # Instructions
323
+ st.sidebar.markdown("""
324
+ ## Instructions:
325
+
326
+ 1. **Paste Job Description** - The AI will analyze the job requirements
327
+ 2. **Paste Your Resume** - For comparison and analysis
328
+ 3. **Click Analyze** - AI will score and suggest improvements
329
+ 4. **Download** - Save as JSON or Word document
330
+
331
+ ## Tips for Better Results:
332
+
333
+ - Provide detailed job descriptions
334
+ - Include your full resume
335
+ - Be specific about your skills and experiences
336
+ """)
337
+
338
+ # About
339
+ st.sidebar.markdown("""
340
+ ---
341
+ ## About
342
+
343
+ This application uses the `nakamoto-yama/t5-resume-generation` model and
344
+ TF-IDF based similarity analysis to provide comprehensive resume-job
345
+ description matching.
346
+ """)
347
+
348
+ if __name__ == "__main__":
349
+ main()
get-pip.py ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ streamlit>=1.28.0
2
+ torch>=2.0.0
3
+ transformers>=4.35.0
4
+ python-docx>=0.8.11
5
+ reportlab>=4.0.0
6
+ pillow>=10.0.0
7
+ numpy>=1.24.0
8
+ scikit-learn>=1.3.0
space.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ title: AI Resume Tailor
2
+ emoji: 📄
3
+ colorFrom: blue
4
+ colorTo: purple
5
+ sdk: docker
6
+ pinned: false
7
+ app_port: 7860
sttemlit_res.ipynb ADDED
@@ -0,0 +1,433 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "id": "c4c6d9f8",
7
+ "metadata": {},
8
+ "outputs": [
9
+ {
10
+ "name": "stdout",
11
+ "output_type": "stream",
12
+ "text": [
13
+ "Hit:1 https://cloud.r-project.org/bin/linux/ubuntu jammy-cran40/ InRelease\n",
14
+ "Get:2 https://cli.github.com/packages stable InRelease [3,917 B] \n",
15
+ "Hit:3 http://security.ubuntu.com/ubuntu jammy-security InRelease \n",
16
+ "Hit:4 https://r2u.stat.illinois.edu/ubuntu jammy InRelease \n",
17
+ "Hit:5 http://archive.ubuntu.com/ubuntu jammy InRelease \n",
18
+ "Hit:6 http://archive.ubuntu.com/ubuntu jammy-updates InRelease \n",
19
+ "Hit:7 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu jammy InRelease\n",
20
+ "Hit:8 http://archive.ubuntu.com/ubuntu jammy-backports InRelease\n",
21
+ "Hit:9 https://ppa.launchpadcontent.net/ubuntugis/ppa/ubuntu jammy InRelease\n",
22
+ "Fetched 3,917 B in 1s (4,057 B/s)\n",
23
+ "Reading package lists... Done\n",
24
+ "W: Skipping acquire of configured file 'main/source/Sources' as repository 'https://r2u.stat.illinois.edu/ubuntu jammy InRelease' does not seem to provide it (sources.list entry misspelt?)\n",
25
+ "Reading package lists... Done\n",
26
+ "Building dependency tree... Done\n",
27
+ "Reading state information... Done\n",
28
+ "python3-venv is already the newest version (3.10.6-1~22.04.1).\n",
29
+ "0 upgraded, 0 newly installed, 0 to remove and 98 not upgraded.\n",
30
+ " % Total % Received % Xferd Average Speed Time Time Time Current\n",
31
+ " Dload Upload Total Spent Left Speed\n",
32
+ "100 2142k 100 2142k 0 0 14.5M 0 --:--:-- --:--:-- --:--:-- 14.6M\n",
33
+ "Collecting pip\n",
34
+ " Using cached pip-26.0.1-py3-none-any.whl.metadata (4.7 kB)\n",
35
+ "Using cached pip-26.0.1-py3-none-any.whl (1.8 MB)\n",
36
+ "Installing collected packages: pip\n",
37
+ "Successfully installed pip-26.0.1\n",
38
+ "Requirement already satisfied: pip in ./venv/lib/python3.12/site-packages (26.0.1)\n",
39
+ "Virtual environment 'venv' has been successfully created and is ready for use.\n"
40
+ ]
41
+ }
42
+ ],
43
+ "source": [
44
+ "# Install system dependency for venv\n",
45
+ "!apt-get update\n",
46
+ "!apt-get install -y python3-venv\n",
47
+ "\n",
48
+ "# Create a virtual environment without pip to avoid the ensurepip error\n",
49
+ "!rm -rf venv\n",
50
+ "!python3 -m venv venv --without-pip\n",
51
+ "\n",
52
+ "# Manually install pip inside the virtual environment\n",
53
+ "!curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py\n",
54
+ "!venv/bin/python3 get-pip.py\n",
55
+ "!rm get-pip.py\n",
56
+ "\n",
57
+ "# Upgrade pip inside the venv\n",
58
+ "!venv/bin/pip install --upgrade pip\n",
59
+ "\n",
60
+ "print(\"Virtual environment 'venv' has been successfully created and is ready for use.\")"
61
+ ]
62
+ },
63
+ {
64
+ "cell_type": "code",
65
+ "execution_count": 2,
66
+ "id": "352bba8a",
67
+ "metadata": {},
68
+ "outputs": [],
69
+ "source": [
70
+ "!source venv/bin/activate"
71
+ ]
72
+ },
73
+ {
74
+ "cell_type": "code",
75
+ "execution_count": 3,
76
+ "id": "3d1fd8d2",
77
+ "metadata": {},
78
+ "outputs": [
79
+ {
80
+ "name": "stdout",
81
+ "output_type": "stream",
82
+ "text": [
83
+ "Collecting numpy\n",
84
+ " Using cached numpy-2.4.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.metadata (6.6 kB)\n",
85
+ "Using cached numpy-2.4.2-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (16.6 MB)\n",
86
+ "Installing collected packages: numpy\n",
87
+ "Successfully installed numpy-2.4.2\n"
88
+ ]
89
+ }
90
+ ],
91
+ "source": [
92
+ "!venv/bin/pip install numpy #Testing install to try"
93
+ ]
94
+ },
95
+ {
96
+ "cell_type": "code",
97
+ "execution_count": 4,
98
+ "id": "c08277fa",
99
+ "metadata": {},
100
+ "outputs": [
101
+ {
102
+ "name": "stdout",
103
+ "output_type": "stream",
104
+ "text": [
105
+ "Numpy version: 2.4.2\n"
106
+ ]
107
+ }
108
+ ],
109
+ "source": [
110
+ "!venv/bin/python3 -c \"import numpy; print('Numpy version:', numpy.__version__)\""
111
+ ]
112
+ },
113
+ {
114
+ "cell_type": "code",
115
+ "execution_count": 5,
116
+ "id": "a48f575a",
117
+ "metadata": {},
118
+ "outputs": [
119
+ {
120
+ "name": "stdout",
121
+ "output_type": "stream",
122
+ "text": [
123
+ "Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
124
+ ]
125
+ }
126
+ ],
127
+ "source": [
128
+ "from google.colab import drive\n",
129
+ "drive.mount('/content/drive')"
130
+ ]
131
+ },
132
+ {
133
+ "cell_type": "code",
134
+ "execution_count": 6,
135
+ "id": "47b90d96",
136
+ "metadata": {},
137
+ "outputs": [
138
+ {
139
+ "name": "stdout",
140
+ "output_type": "stream",
141
+ "text": [
142
+ "app.py\trequirements.txt\n"
143
+ ]
144
+ }
145
+ ],
146
+ "source": [
147
+ "# path = \"/content/drive/MyDrive/col/app.py\"\n",
148
+ "# print(f\"File path: {path}\")\n",
149
+ "!ls /content/drive/MyDrive/col/"
150
+ ]
151
+ },
152
+ {
153
+ "cell_type": "code",
154
+ "execution_count": 7,
155
+ "id": "bacb0374",
156
+ "metadata": {},
157
+ "outputs": [
158
+ {
159
+ "name": "stdout",
160
+ "output_type": "stream",
161
+ "text": [
162
+ "Requirement already satisfied: transformers in /usr/local/lib/python3.12/dist-packages (from -r /content/drive/MyDrive/col/requirements.txt (line 1)) (5.0.0)\n",
163
+ "Requirement already satisfied: sentencepiece in /usr/local/lib/python3.12/dist-packages (from -r /content/drive/MyDrive/col/requirements.txt (line 2)) (0.2.1)\n",
164
+ "Requirement already satisfied: streamlit in /usr/local/lib/python3.12/dist-packages (from -r /content/drive/MyDrive/col/requirements.txt (line 3)) (1.54.0)\n",
165
+ "Requirement already satisfied: python-docx in /usr/local/lib/python3.12/dist-packages (from -r /content/drive/MyDrive/col/requirements.txt (line 4)) (1.2.0)\n",
166
+ "Requirement already satisfied: reportlab in /usr/local/lib/python3.12/dist-packages (from -r /content/drive/MyDrive/col/requirements.txt (line 5)) (4.4.10)\n",
167
+ "Requirement already satisfied: accelerate in /usr/local/lib/python3.12/dist-packages (from -r /content/drive/MyDrive/col/requirements.txt (line 6)) (1.12.0)\n",
168
+ "Requirement already satisfied: torch in /usr/local/lib/python3.12/dist-packages (from -r /content/drive/MyDrive/col/requirements.txt (line 7)) (2.10.0+cpu)\n",
169
+ "Requirement already satisfied: filelock in /usr/local/lib/python3.12/dist-packages (from transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (3.24.3)\n",
170
+ "Requirement already satisfied: huggingface-hub<2.0,>=1.3.0 in /usr/local/lib/python3.12/dist-packages (from transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (1.4.1)\n",
171
+ "Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.12/dist-packages (from transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (2.0.2)\n",
172
+ "Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.12/dist-packages (from transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (26.0)\n",
173
+ "Requirement already satisfied: pyyaml>=5.1 in /usr/local/lib/python3.12/dist-packages (from transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (6.0.3)\n",
174
+ "Requirement already satisfied: regex!=2019.12.17 in /usr/local/lib/python3.12/dist-packages (from transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (2025.11.3)\n",
175
+ "Requirement already satisfied: tokenizers<=0.23.0,>=0.22.0 in /usr/local/lib/python3.12/dist-packages (from transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (0.22.2)\n",
176
+ "Requirement already satisfied: typer-slim in /usr/local/lib/python3.12/dist-packages (from transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (0.24.0)\n",
177
+ "Requirement already satisfied: safetensors>=0.4.3 in /usr/local/lib/python3.12/dist-packages (from transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (0.7.0)\n",
178
+ "Requirement already satisfied: tqdm>=4.27 in /usr/local/lib/python3.12/dist-packages (from transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (4.67.3)\n",
179
+ "Requirement already satisfied: altair!=5.4.0,!=5.4.1,<7,>=4.0 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (5.5.0)\n",
180
+ "Requirement already satisfied: blinker<2,>=1.5.0 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (1.9.0)\n",
181
+ "Requirement already satisfied: cachetools<7,>=5.5 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (6.2.6)\n",
182
+ "Requirement already satisfied: click<9,>=7.0 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (8.3.1)\n",
183
+ "Requirement already satisfied: gitpython!=3.1.19,<4,>=3.0.7 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (3.1.46)\n",
184
+ "Requirement already satisfied: pandas<3,>=1.4.0 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (2.2.2)\n",
185
+ "Requirement already satisfied: pillow<13,>=7.1.0 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (11.3.0)\n",
186
+ "Requirement already satisfied: pydeck<1,>=0.8.0b4 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (0.9.1)\n",
187
+ "Requirement already satisfied: protobuf<7,>=3.20 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (5.29.6)\n",
188
+ "Requirement already satisfied: pyarrow>=7.0 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (18.1.0)\n",
189
+ "Requirement already satisfied: requests<3,>=2.27 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (2.32.4)\n",
190
+ "Requirement already satisfied: tenacity<10,>=8.1.0 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (9.1.4)\n",
191
+ "Requirement already satisfied: toml<2,>=0.10.1 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (0.10.2)\n",
192
+ "Requirement already satisfied: tornado!=6.5.0,<7,>=6.0.3 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (6.5.1)\n",
193
+ "Requirement already satisfied: typing-extensions<5,>=4.10.0 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (4.15.0)\n",
194
+ "Requirement already satisfied: watchdog<7,>=2.1.5 in /usr/local/lib/python3.12/dist-packages (from streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (6.0.0)\n",
195
+ "Requirement already satisfied: lxml>=3.1.0 in /usr/local/lib/python3.12/dist-packages (from python-docx->-r /content/drive/MyDrive/col/requirements.txt (line 4)) (6.0.2)\n",
196
+ "Requirement already satisfied: charset-normalizer in /usr/local/lib/python3.12/dist-packages (from reportlab->-r /content/drive/MyDrive/col/requirements.txt (line 5)) (3.4.4)\n",
197
+ "Requirement already satisfied: psutil in /usr/local/lib/python3.12/dist-packages (from accelerate->-r /content/drive/MyDrive/col/requirements.txt (line 6)) (5.9.5)\n",
198
+ "Requirement already satisfied: setuptools in /usr/local/lib/python3.12/dist-packages (from torch->-r /content/drive/MyDrive/col/requirements.txt (line 7)) (75.2.0)\n",
199
+ "Requirement already satisfied: sympy>=1.13.3 in /usr/local/lib/python3.12/dist-packages (from torch->-r /content/drive/MyDrive/col/requirements.txt (line 7)) (1.14.0)\n",
200
+ "Requirement already satisfied: networkx>=2.5.1 in /usr/local/lib/python3.12/dist-packages (from torch->-r /content/drive/MyDrive/col/requirements.txt (line 7)) (3.6.1)\n",
201
+ "Requirement already satisfied: jinja2 in /usr/local/lib/python3.12/dist-packages (from torch->-r /content/drive/MyDrive/col/requirements.txt (line 7)) (3.1.6)\n",
202
+ "Requirement already satisfied: fsspec>=0.8.5 in /usr/local/lib/python3.12/dist-packages (from torch->-r /content/drive/MyDrive/col/requirements.txt (line 7)) (2025.3.0)\n",
203
+ "Requirement already satisfied: jsonschema>=3.0 in /usr/local/lib/python3.12/dist-packages (from altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (4.26.0)\n",
204
+ "Requirement already satisfied: narwhals>=1.14.2 in /usr/local/lib/python3.12/dist-packages (from altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (2.17.0)\n",
205
+ "Requirement already satisfied: gitdb<5,>=4.0.1 in /usr/local/lib/python3.12/dist-packages (from gitpython!=3.1.19,<4,>=3.0.7->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (4.0.12)\n",
206
+ "Requirement already satisfied: hf-xet<2.0.0,>=1.2.0 in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<2.0,>=1.3.0->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (1.3.0)\n",
207
+ "Requirement already satisfied: httpx<1,>=0.23.0 in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<2.0,>=1.3.0->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (0.28.1)\n",
208
+ "Requirement already satisfied: shellingham in /usr/local/lib/python3.12/dist-packages (from huggingface-hub<2.0,>=1.3.0->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (1.5.4)\n",
209
+ "Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.12/dist-packages (from pandas<3,>=1.4.0->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (2.9.0.post0)\n",
210
+ "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.12/dist-packages (from pandas<3,>=1.4.0->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (2025.2)\n",
211
+ "Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.12/dist-packages (from pandas<3,>=1.4.0->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (2025.3)\n",
212
+ "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.12/dist-packages (from jinja2->torch->-r /content/drive/MyDrive/col/requirements.txt (line 7)) (3.0.3)\n",
213
+ "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.12/dist-packages (from requests<3,>=2.27->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (3.11)\n",
214
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.12/dist-packages (from requests<3,>=2.27->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (2.5.0)\n",
215
+ "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.12/dist-packages (from requests<3,>=2.27->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (2026.1.4)\n",
216
+ "Requirement already satisfied: mpmath<1.4,>=1.1.0 in /usr/local/lib/python3.12/dist-packages (from sympy>=1.13.3->torch->-r /content/drive/MyDrive/col/requirements.txt (line 7)) (1.3.0)\n",
217
+ "Requirement already satisfied: typer>=0.24.0 in /usr/local/lib/python3.12/dist-packages (from typer-slim->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (0.24.1)\n",
218
+ "Requirement already satisfied: smmap<6,>=3.0.1 in /usr/local/lib/python3.12/dist-packages (from gitdb<5,>=4.0.1->gitpython!=3.1.19,<4,>=3.0.7->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (5.0.2)\n",
219
+ "Requirement already satisfied: anyio in /usr/local/lib/python3.12/dist-packages (from httpx<1,>=0.23.0->huggingface-hub<2.0,>=1.3.0->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (4.12.1)\n",
220
+ "Requirement already satisfied: httpcore==1.* in /usr/local/lib/python3.12/dist-packages (from httpx<1,>=0.23.0->huggingface-hub<2.0,>=1.3.0->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (1.0.9)\n",
221
+ "Requirement already satisfied: h11>=0.16 in /usr/local/lib/python3.12/dist-packages (from httpcore==1.*->httpx<1,>=0.23.0->huggingface-hub<2.0,>=1.3.0->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (0.16.0)\n",
222
+ "Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.12/dist-packages (from jsonschema>=3.0->altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (25.4.0)\n",
223
+ "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.12/dist-packages (from jsonschema>=3.0->altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (2025.9.1)\n",
224
+ "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.12/dist-packages (from jsonschema>=3.0->altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (0.37.0)\n",
225
+ "Requirement already satisfied: rpds-py>=0.25.0 in /usr/local/lib/python3.12/dist-packages (from jsonschema>=3.0->altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (0.30.0)\n",
226
+ "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.12/dist-packages (from python-dateutil>=2.8.2->pandas<3,>=1.4.0->streamlit->-r /content/drive/MyDrive/col/requirements.txt (line 3)) (1.17.0)\n",
227
+ "Requirement already satisfied: rich>=12.3.0 in /usr/local/lib/python3.12/dist-packages (from typer>=0.24.0->typer-slim->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (13.9.4)\n",
228
+ "Requirement already satisfied: annotated-doc>=0.0.2 in /usr/local/lib/python3.12/dist-packages (from typer>=0.24.0->typer-slim->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (0.0.4)\n",
229
+ "Requirement already satisfied: markdown-it-py>=2.2.0 in /usr/local/lib/python3.12/dist-packages (from rich>=12.3.0->typer>=0.24.0->typer-slim->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (4.0.0)\n",
230
+ "Requirement already satisfied: pygments<3.0.0,>=2.13.0 in /usr/local/lib/python3.12/dist-packages (from rich>=12.3.0->typer>=0.24.0->typer-slim->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (2.19.2)\n",
231
+ "Requirement already satisfied: mdurl~=0.1 in /usr/local/lib/python3.12/dist-packages (from markdown-it-py>=2.2.0->rich>=12.3.0->typer>=0.24.0->typer-slim->transformers->-r /content/drive/MyDrive/col/requirements.txt (line 1)) (0.1.2)\n"
232
+ ]
233
+ }
234
+ ],
235
+ "source": [
236
+ "!pip install -r /content/drive/MyDrive/col/requirements.txt\n"
237
+ ]
238
+ },
239
+ {
240
+ "cell_type": "code",
241
+ "execution_count": 8,
242
+ "id": "c03251a7",
243
+ "metadata": {},
244
+ "outputs": [],
245
+ "source": [
246
+ "!streamlit run /content/drive/MyDrive/col/app.py &>/content/logs.txt &"
247
+ ]
248
+ },
249
+ {
250
+ "cell_type": "code",
251
+ "execution_count": 5,
252
+ "id": "4960c3dc",
253
+ "metadata": {},
254
+ "outputs": [
255
+ {
256
+ "name": "stdout",
257
+ "output_type": "stream",
258
+ "text": [
259
+ "Requirement already satisfied: pyngrok in ./venv/lib/python3.12/site-packages (7.5.0)\n",
260
+ "Requirement already satisfied: PyYAML>=5.1 in ./venv/lib/python3.12/site-packages (from pyngrok) (6.0.3)\n",
261
+ "Requirement already satisfied: streamlit in /usr/local/lib/python3.12/dist-packages (1.54.0)\n",
262
+ "Collecting pyngrok\n",
263
+ " Using cached pyngrok-7.5.0-py3-none-any.whl.metadata (8.1 kB)\n",
264
+ "Requirement already satisfied: altair!=5.4.0,!=5.4.1,<7,>=4.0 in /usr/local/lib/python3.12/dist-packages (from streamlit) (5.5.0)\n",
265
+ "Requirement already satisfied: blinker<2,>=1.5.0 in /usr/local/lib/python3.12/dist-packages (from streamlit) (1.9.0)\n",
266
+ "Requirement already satisfied: cachetools<7,>=5.5 in /usr/local/lib/python3.12/dist-packages (from streamlit) (6.2.6)\n",
267
+ "Requirement already satisfied: click<9,>=7.0 in /usr/local/lib/python3.12/dist-packages (from streamlit) (8.3.1)\n",
268
+ "Requirement already satisfied: gitpython!=3.1.19,<4,>=3.0.7 in /usr/local/lib/python3.12/dist-packages (from streamlit) (3.1.46)\n",
269
+ "Requirement already satisfied: numpy<3,>=1.23 in /usr/local/lib/python3.12/dist-packages (from streamlit) (2.0.2)\n",
270
+ "Requirement already satisfied: packaging>=20 in /usr/local/lib/python3.12/dist-packages (from streamlit) (26.0)\n",
271
+ "Requirement already satisfied: pandas<3,>=1.4.0 in /usr/local/lib/python3.12/dist-packages (from streamlit) (2.2.2)\n",
272
+ "Requirement already satisfied: pillow<13,>=7.1.0 in /usr/local/lib/python3.12/dist-packages (from streamlit) (11.3.0)\n",
273
+ "Requirement already satisfied: pydeck<1,>=0.8.0b4 in /usr/local/lib/python3.12/dist-packages (from streamlit) (0.9.1)\n",
274
+ "Requirement already satisfied: protobuf<7,>=3.20 in /usr/local/lib/python3.12/dist-packages (from streamlit) (5.29.6)\n",
275
+ "Requirement already satisfied: pyarrow>=7.0 in /usr/local/lib/python3.12/dist-packages (from streamlit) (18.1.0)\n",
276
+ "Requirement already satisfied: requests<3,>=2.27 in /usr/local/lib/python3.12/dist-packages (from streamlit) (2.32.4)\n",
277
+ "Requirement already satisfied: tenacity<10,>=8.1.0 in /usr/local/lib/python3.12/dist-packages (from streamlit) (9.1.4)\n",
278
+ "Requirement already satisfied: toml<2,>=0.10.1 in /usr/local/lib/python3.12/dist-packages (from streamlit) (0.10.2)\n",
279
+ "Requirement already satisfied: tornado!=6.5.0,<7,>=6.0.3 in /usr/local/lib/python3.12/dist-packages (from streamlit) (6.5.1)\n",
280
+ "Requirement already satisfied: typing-extensions<5,>=4.10.0 in /usr/local/lib/python3.12/dist-packages (from streamlit) (4.15.0)\n",
281
+ "Requirement already satisfied: watchdog<7,>=2.1.5 in /usr/local/lib/python3.12/dist-packages (from streamlit) (6.0.0)\n",
282
+ "Requirement already satisfied: PyYAML>=5.1 in /usr/local/lib/python3.12/dist-packages (from pyngrok) (6.0.3)\n",
283
+ "Requirement already satisfied: jinja2 in /usr/local/lib/python3.12/dist-packages (from altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit) (3.1.6)\n",
284
+ "Requirement already satisfied: jsonschema>=3.0 in /usr/local/lib/python3.12/dist-packages (from altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit) (4.26.0)\n",
285
+ "Requirement already satisfied: narwhals>=1.14.2 in /usr/local/lib/python3.12/dist-packages (from altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit) (2.17.0)\n",
286
+ "Requirement already satisfied: gitdb<5,>=4.0.1 in /usr/local/lib/python3.12/dist-packages (from gitpython!=3.1.19,<4,>=3.0.7->streamlit) (4.0.12)\n",
287
+ "Requirement already satisfied: python-dateutil>=2.8.2 in /usr/local/lib/python3.12/dist-packages (from pandas<3,>=1.4.0->streamlit) (2.9.0.post0)\n",
288
+ "Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.12/dist-packages (from pandas<3,>=1.4.0->streamlit) (2025.2)\n",
289
+ "Requirement already satisfied: tzdata>=2022.7 in /usr/local/lib/python3.12/dist-packages (from pandas<3,>=1.4.0->streamlit) (2025.3)\n",
290
+ "Requirement already satisfied: charset_normalizer<4,>=2 in /usr/local/lib/python3.12/dist-packages (from requests<3,>=2.27->streamlit) (3.4.4)\n",
291
+ "Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.12/dist-packages (from requests<3,>=2.27->streamlit) (3.11)\n",
292
+ "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/local/lib/python3.12/dist-packages (from requests<3,>=2.27->streamlit) (2.5.0)\n",
293
+ "Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.12/dist-packages (from requests<3,>=2.27->streamlit) (2026.1.4)\n",
294
+ "Requirement already satisfied: smmap<6,>=3.0.1 in /usr/local/lib/python3.12/dist-packages (from gitdb<5,>=4.0.1->gitpython!=3.1.19,<4,>=3.0.7->streamlit) (5.0.2)\n",
295
+ "Requirement already satisfied: MarkupSafe>=2.0 in /usr/local/lib/python3.12/dist-packages (from jinja2->altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit) (3.0.3)\n",
296
+ "Requirement already satisfied: attrs>=22.2.0 in /usr/local/lib/python3.12/dist-packages (from jsonschema>=3.0->altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit) (25.4.0)\n",
297
+ "Requirement already satisfied: jsonschema-specifications>=2023.03.6 in /usr/local/lib/python3.12/dist-packages (from jsonschema>=3.0->altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit) (2025.9.1)\n",
298
+ "Requirement already satisfied: referencing>=0.28.4 in /usr/local/lib/python3.12/dist-packages (from jsonschema>=3.0->altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit) (0.37.0)\n",
299
+ "Requirement already satisfied: rpds-py>=0.25.0 in /usr/local/lib/python3.12/dist-packages (from jsonschema>=3.0->altair!=5.4.0,!=5.4.1,<7,>=4.0->streamlit) (0.30.0)\n",
300
+ "Requirement already satisfied: six>=1.5 in /usr/local/lib/python3.12/dist-packages (from python-dateutil>=2.8.2->pandas<3,>=1.4.0->streamlit) (1.17.0)\n",
301
+ "Using cached pyngrok-7.5.0-py3-none-any.whl (24 kB)\n",
302
+ "Installing collected packages: pyngrok\n",
303
+ "Successfully installed pyngrok-7.5.0\n",
304
+ "NgrokTunnel: \"https://4577-35-245-14-130.ngrok-free.app\" -> \"http://localhost:8501\" \n"
305
+ ]
306
+ },
307
+ {
308
+ "name": "stderr",
309
+ "output_type": "stream",
310
+ "text": [
311
+ "WARNING:pyngrok.process.ngrok:t=2026-03-02T05:37:32+0000 lvl=warn msg=\"failed to open private leg\" id=d94b4329925f privaddr=localhost:8501 err=\"dial tcp [::1]:8501: connect: connection refused\"\n"
312
+ ]
313
+ }
314
+ ],
315
+ "source": [
316
+ "!venv/bin/pip install pyngrok #Testing install to try\n",
317
+ "!pip install streamlit pyngrok\n",
318
+ "from pyngrok import ngrok\n",
319
+ "\n",
320
+ "ngrok.set_auth_token(\"2bWJUMI0C3IsPU1al4qDdULv3gc_774TGcNQjZYWNSZs4YNMq\")\n",
321
+ "print(ngrok.connect(8501))"
322
+ ]
323
+ },
324
+ {
325
+ "cell_type": "code",
326
+ "execution_count": null,
327
+ "id": "d9d71928",
328
+ "metadata": {},
329
+ "outputs": [
330
+ {
331
+ "name": "stdout",
332
+ "output_type": "stream",
333
+ "text": [
334
+ "\n",
335
+ "Collecting usage statistics. To deactivate, set browser.gatherUsageStats to false.\n",
336
+ "\u001b[0m\n",
337
+ "\u001b[0m\n",
338
+ "\u001b[34m\u001b[1m You can now view your Streamlit app in your browser.\u001b[0m\n",
339
+ "\u001b[0m\n",
340
+ "\u001b[34m Local URL: \u001b[0m\u001b[1mhttp://localhost:8501\u001b[0m\n",
341
+ "\u001b[34m Network URL: \u001b[0m\u001b[1mhttp://172.28.0.12:8501\u001b[0m\n",
342
+ "\u001b[34m External URL: \u001b[0m\u001b[1mhttp://35.245.14.130:8501\u001b[0m\n",
343
+ "\u001b[0m\n"
344
+ ]
345
+ },
346
+ {
347
+ "name": "stdout",
348
+ "output_type": "stream",
349
+ "text": [
350
+ "\u001b[34m Stopping...\u001b[0m\n"
351
+ ]
352
+ }
353
+ ],
354
+ "source": [
355
+ "!streamlit run /content/drive/MyDrive/col/app.py --server.port 8501 --server.address 0.0.0.0 &"
356
+ ]
357
+ },
358
+ {
359
+ "cell_type": "code",
360
+ "execution_count": null,
361
+ "id": "8cb03542",
362
+ "metadata": {},
363
+ "outputs": [
364
+ {
365
+ "name": "stdout",
366
+ "output_type": "stream",
367
+ "text": [
368
+ "\u001b[1G\u001b[0K⠙\u001b[1G\u001b[0K⠹\u001b[1G\u001b[0K⠸\u001b[1G\u001b[0K⠼\u001b[1G\u001b[0K⠴\u001b[1G\u001b[0K⠦\u001b[1G\u001b[0K⠧\u001b[1G\u001b[0K⠇\u001b[1G\u001b[0K⠏\u001b[1G\u001b[0K⠋\u001b[1G\u001b[0K⠙\u001b[1G\u001b[0K⠹\u001b[1G\u001b[0K⠸\u001b[1G\u001b[0K⠼\u001b[1G\u001b[0K⠴\u001b[1G\u001b[0K⠦\u001b[1G\u001b[0K⠧\u001b[1G\u001b[0K⠇\u001b[1G\u001b[0K⠏\u001b[1G\u001b[0K⠋\u001b[1G\u001b[0K\n",
369
+ "added 22 packages in 2s\n",
370
+ "\u001b[1G\u001b[0K⠋\u001b[1G\u001b[0K\n",
371
+ "\u001b[1G\u001b[0K⠋\u001b[1G\u001b[0K3 packages are looking for funding\n",
372
+ "\u001b[1G\u001b[0K⠋\u001b[1G\u001b[0K run `npm fund` for details\n",
373
+ "\u001b[1G\u001b[0K⠋\u001b[1G\u001b[0K\n",
374
+ "Collecting usage statistics. To deactivate, set browser.gatherUsageStats to false.\n",
375
+ "\u001b[0m\n",
376
+ "\u001b[0m\n",
377
+ "\u001b[34m\u001b[1m You can now view your Streamlit app in your browser.\u001b[0m\n",
378
+ "\u001b[0m\n",
379
+ "\u001b[34m Local URL: \u001b[0m\u001b[1mhttp://localhost:8501\u001b[0m\n",
380
+ "\u001b[34m Network URL: \u001b[0m\u001b[1mhttp://172.28.0.12:8501\u001b[0m\n",
381
+ "\u001b[34m External URL: \u001b[0m\u001b[1mhttp://35.245.14.130:8501\u001b[0m\n",
382
+ "\u001b[0m\n",
383
+ "\u001b[34m Stopping...\u001b[0m\n",
384
+ "your url is: https://wise-weeks-appear.loca.lt\n"
385
+ ]
386
+ },
387
+ {
388
+ "name": "stdout",
389
+ "output_type": "stream",
390
+ "text": [
391
+ "^C\n"
392
+ ]
393
+ }
394
+ ],
395
+ "source": [
396
+ "!npm install -g localtunnel\n",
397
+ "!streamlit run /content/drive/MyDrive/col/app.py --server.port 8501 &\n",
398
+ "!lt --port 8501"
399
+ ]
400
+ },
401
+ {
402
+ "cell_type": "code",
403
+ "execution_count": 12,
404
+ "id": "31c3071b",
405
+ "metadata": {},
406
+ "outputs": [],
407
+ "source": [
408
+ "!pkill -f streamlit"
409
+ ]
410
+ }
411
+ ],
412
+ "metadata": {
413
+ "kernelspec": {
414
+ "display_name": "Python 3 (ipykernel)",
415
+ "language": "python",
416
+ "name": "python3"
417
+ },
418
+ "language_info": {
419
+ "codemirror_mode": {
420
+ "name": "ipython",
421
+ "version": 3
422
+ },
423
+ "file_extension": ".py",
424
+ "mimetype": "text/x-python",
425
+ "name": "python",
426
+ "nbconvert_exporter": "python",
427
+ "pygments_lexer": "ipython3",
428
+ "version": "3.12.12"
429
+ }
430
+ },
431
+ "nbformat": 4,
432
+ "nbformat_minor": 5
433
+ }