Skip to content

Commit

Permalink
Made some comments in the code.
Browse files Browse the repository at this point in the history
  • Loading branch information
HunterH1218 committed Jul 4, 2024
1 parent c203f35 commit d7d649f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
9 changes: 3 additions & 6 deletions models/summerize_model.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,23 @@
import os
import google.generativeai as genai

# Simple confiuration down below
genai.configure(api_key=os.environ["GEMINI_API_KEY"])



memory = []

generation_config = {
"temperature": 0.85,
"top_p": 0.95,
"top_k": 64,
"max_output_tokens": 15200,
"response_mime_type": "text/plain",
}

model = genai.GenerativeModel(
model_name="gemini-1.0-pro",
generation_config=generation_config,

)

# This function is used to generate a response from the model
def generate_response(prompt):
response = model.generate_content([
"Your job is to summerize any text given to you. Do not give any other information than what you know from the text you are given. You are giving the user your summery, but they cannot see what you are summerizing, so be sure to include all the details, but in a consise manner. Just tell them the info you are given, but a summery.",
Expand All @@ -29,4 +26,4 @@ def generate_response(prompt):
])
memory.append(f"input: {prompt}")
memory.append(f"output: {response.text}")
return response.text
return response.text
6 changes: 3 additions & 3 deletions models/text_model.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import os
import google.generativeai as genai

# Basic Configuration
dir_path = os.path.dirname(os.path.realpath(__file__))
file_path = os.path.join(dir_path, '..', 'data_files', 'training_data.txt')
with open(file_path, 'r') as file:
training_data = file.read()

memory = []

generation_config = {
"temperature": 0.85,
"top_p": 0.95,
"top_k": 64,
"max_output_tokens": 15000,
"response_mime_type": "text/plain",
}

model = genai.GenerativeModel(
model_name="gemini-1.0-pro",
generation_config=generation_config,

)


# Function to generate a response from the model
def generate_response(prompt):
response = model.generate_content([
training_data,
Expand Down

0 comments on commit d7d649f

Please sign in to comment.