Mr-Vicky-01 commited on
Commit
b4ed342
·
verified ·
1 Parent(s): 6a6d286

Update llm.py

Browse files
Files changed (1) hide show
  1. llm.py +22 -25
llm.py CHANGED
@@ -1,26 +1,23 @@
1
- import google.generativeai as genai
2
- from dotenv import load_dotenv
3
- import os
4
-
5
-
6
- # Load environment variables
7
- load_dotenv()
8
- os.environ["GOOGLE_API_KEY"] = os.getenv("GOOGLE_API_KEY")
9
- genai.configure(api_key=os.environ["GOOGLE_API_KEY"])
10
-
11
- # Define the GeminiModel class for Gemini LLM
12
- class Model:
13
- def __init__(self) -> None:
14
- self.model = genai.GenerativeModel('gemini-1.5-flash-latest')
15
-
16
- def enhance_idea(self, idea):
17
- prompt = """Give me the Pencil art prompt with this idea using this key words [Contrast: Utilize varying shades of gray to create depth and dimension.
18
- Texture: Capture the texture of different surfaces like wood, fabric, or skin.
19
- Detail: Focus on intricate details to enhance realism.
20
- Shading: Use different pencil pressures to create smooth gradients and sharp contrasts.
21
- Light and Shadow: Create the illusion of light sources and how they interact with objects.
22
- Composition: Arrange elements within the drawing to create a visually appealing layout.
23
- Strokes: Experiment with different pencil strokes (e.g., hatching, cross-hatching, stippling) for texture and shading.
24
- Negative Space: Use empty areas to define shapes and create balance.], \n Idea: """ + idea + "\n important note: your response must only contain the idea of classic B&W pencil art, without unnecessary elements like ('Enhanced Art Idea:' and markdown format like '##', '*')"
25
- response = self.model.generate_content([prompt])
26
  return response.text
 
1
+ import google.generativeai as genai
2
+ import os
3
+
4
+
5
+ os.environ["GOOGLE_API_KEY"] = os.getenv("GOOGLE_API_KEY")
6
+ genai.configure(api_key=os.environ["GOOGLE_API_KEY"])
7
+
8
+ # Define the GeminiModel class for Gemini LLM
9
+ class Model:
10
+ def __init__(self) -> None:
11
+ self.model = genai.GenerativeModel('gemini-1.5-flash-latest')
12
+
13
+ def enhance_idea(self, idea):
14
+ prompt = """Give me the Pencil art prompt with this idea using this key words [Contrast: Utilize varying shades of gray to create depth and dimension.
15
+ Texture: Capture the texture of different surfaces like wood, fabric, or skin.
16
+ Detail: Focus on intricate details to enhance realism.
17
+ Shading: Use different pencil pressures to create smooth gradients and sharp contrasts.
18
+ Light and Shadow: Create the illusion of light sources and how they interact with objects.
19
+ Composition: Arrange elements within the drawing to create a visually appealing layout.
20
+ Strokes: Experiment with different pencil strokes (e.g., hatching, cross-hatching, stippling) for texture and shading.
21
+ Negative Space: Use empty areas to define shapes and create balance.], \n Idea: """ + idea + "\n important note: your response must only contain the idea of classic B&W pencil art, without unnecessary elements like ('Enhanced Art Idea:' and markdown format like '##', '*')"
22
+ response = self.model.generate_content([prompt])
 
 
 
23
  return response.text