Spaces:
Running
Running
Mr-Vicky-01
commited on
Update llm.py
Browse files
llm.py
CHANGED
@@ -1,26 +1,23 @@
|
|
1 |
-
import google.generativeai as genai
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
def
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
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
|