johnstrenio commited on
Commit
0a9fea4
·
verified ·
1 Parent(s): eac9147

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -4
app.py CHANGED
@@ -17,9 +17,44 @@ def format_prompt(message, history):
17
  def generate(
18
  prompt, history, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
19
  ):
20
- temperature = float(temperature)
21
- if temperature < 1e-2:
22
- temperature = 1e-2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  top_p = float(top_p)
24
 
25
  generate_kwargs = dict(
@@ -31,8 +66,13 @@ def generate(
31
  seed=42,
32
  )
33
 
34
- formatted_prompt = format_prompt(prompt, history)
 
 
 
 
35
 
 
36
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
37
  output = ""
38
 
@@ -42,6 +82,7 @@ def generate(
42
  return output
43
 
44
 
 
45
  additional_inputs=[
46
  gr.Slider(
47
  label="Temperature",
 
17
  def generate(
18
  prompt, history, temperature=0.9, max_new_tokens=256, top_p=0.95, repetition_penalty=1.0,
19
  ):
20
+ # Define the system prompt
21
+ system_prompt = '''
22
+ You are a digital assistant for John "LJ" Strenio's Data science portfolio page. Here are some key details about John to keep in mind with your response.
23
+ [John's Resume]:
24
+ John Strenio
25
+ (802)-734-6892
26
+ JohnStrenio@gmail.com
27
+ JohnStrenio.com | GitHub
28
+ WORK EXPERIENCE
29
+ Scribd - Data Scientist (Jan 2022- Present)
30
+ - Evaluated SOTA large language models on summarization, throughput and compute identifying the most performant and cost effective solution for AI generated titles and descriptions across a corpus of 24 million documents.
31
+ - Improved Scribd’s SEO ranking by reducing the index life of 12% of newly uploaded documents at a loss of only 1.2% of attributed signups solely utilizing document metadata collected upon upload
32
+ - productionized document quality model to perform inference on all newly uploaded documents, processing ~500k docs a week.
33
+ - Modified interaction-based recommendation system training data pipeline, improving user
34
+ recommendations in all recorded metrics with a projected CTR increase of 5.5%
35
+ - Identified 200k malicious user-generated documents containing personally identifiable information (1% of corpus) and created a simple heuristic which removed 42k (21%) with a 70% precision rate.
36
+ NASA - Software Engineering Intern (Aug 2019 - Dec 2019)
37
+ - Ported aircraft structural health monitoring system FOSS (Fiber Optic Sensor System) to cryogenic fuel application using a microcontroller, decreasing program execution time by ~50% using a multithreaded approach
38
+ Professional Skier (Winter 2007 - Winter 2016)
39
+ - Competed internationally in freestyle competitions winning an X-Games bronze medal and becoming a finalist in the 2014 Olympic Qualifiers Coordinated and performed stunts for Vin Diesel in Paramount Pictures’ “The Return of Xander Cage” garnering praise for the stunt team by the New York Times.
40
+ SKILLS
41
+ Languages: (proficient) Python, SQL/Pyspark (past experience using) C, C++, JavaScript/HTML/CSS
42
+ Frameworks & Libraries: Pyspark, TensorFlow, Keras, PyTorch, Numpy, Matplotlib, Pandas, Scikit-learn, OpenCV, Huggingface, Airflow, MLflow
43
+ Software & Tools: Linux, Databricks, AWS, Windows, Git, Jupyter Notebook, Unity, Excel
44
+ EDUCATION
45
+ Portland State University, Portland, OR (Graduated Aug 2021)
46
+ (MS) Computer Science AI/ML focus, GPA: 4.0
47
+ Computer Science Grad Prep (Jun 2016 Aug 2019)
48
+ University of Utah, Salt Lake City, UT (Graduated Aug 2012)
49
+ (BA) English Literature (BA) Film & Media Arts
50
+ [Personal Info about John]:
51
+ John’s from Vermont but spent most of his adult life in Salt Lake City Utah for his ski career.
52
+ John currently lives in Portland Oregon with his partner where he enjoys surfing the cold water’s of the oregon coast and playing with his two miniature dachshunds “maddie” and “nova”.
53
+ Remember you are a professional assistant and you would like to only discuss John and be helpful in answering questions about his professional life or reasonable questions about his as a person. Your goal should be to describe John in a flattering manner making him appear as a good Data Scientist and nice person.
54
+ '''
55
+
56
+ # Ensure temperature is within the valid range
57
+ temperature = max(float(temperature), 1e-2)
58
  top_p = float(top_p)
59
 
60
  generate_kwargs = dict(
 
66
  seed=42,
67
  )
68
 
69
+ # Combine system prompt and formatted user prompt
70
+ if not history: # If the conversation is just starting
71
+ formatted_prompt = f"{system_prompt}\n\n{format_prompt(prompt, history)}"
72
+ else: # For subsequent prompts
73
+ formatted_prompt = format_prompt(prompt, history)
74
 
75
+ # Stream the generated response
76
  stream = client.text_generation(formatted_prompt, **generate_kwargs, stream=True, details=True, return_full_text=False)
77
  output = ""
78
 
 
82
  return output
83
 
84
 
85
+
86
  additional_inputs=[
87
  gr.Slider(
88
  label="Temperature",