Skip to content

Commit eb6583b

Browse files
wandb weave added
1 parent 39d02a3 commit eb6583b

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

.env.example

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
GOOGLE_API_KEY=YOUR_GOOGLE_API_KEY
1+
GOOGLE_API_KEY=YOUR_GOOGLE_API_KEY
2+
WEAVE_API_KEY=YOUR_WEAVE_API_KEY

requirements.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ streamlit==1.36.0
22
Pillow==10.3.0
33
streamlit-image-select==0.6.0
44
google-generativeai==0.7.1
5-
python-dotenv==1.0.1
5+
python-dotenv==1.0.1
6+
weave==0.51.12

src/model/llm_response.py

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
import sys
44
from dotenv import load_dotenv
55

6+
# Weave import
7+
import weave
8+
weave.init("streamlit-app-builder")
9+
610
import google.generativeai as genai
711

812
# Local imports
@@ -31,6 +35,7 @@
3135
instruction = "Generate the complete Streamlit app code based on the provided preview image or example. Ensure the code includes layout, functionality, and any specified features visible in the image. Incorporate common Streamlit components such as sliders, buttons, and charts where applicable, handle any specific UI elements shown in the image, and ensure proper data handling and user interactions are implemented."
3236

3337

38+
@weave.op()
3439
def generate_text_response(text_prompt: str) -> str:
3540
"""
3641
Generate Streamlit app code based on the provided text prompt.
@@ -82,6 +87,7 @@ def generate_example_image_response(img: str) -> str:
8287
raise CustomExceptionHandling(e, sys) from e
8388

8489

90+
@weave.op()
8591
def generate_image_response(image_data: list) -> str:
8692
"""
8793
Generate a response for an uploaded image using the Gemini API.
@@ -95,6 +101,7 @@ def generate_image_response(image_data: list) -> str:
95101
try:
96102
# Response generation for uploaded image using Gemini API
97103
response = model.generate_content([instruction, image_data[0]])
104+
print(image_data)
98105

99106
# Log the successful response generation
100107
logging.info("Response generated successfully for uploaded image")

0 commit comments

Comments
 (0)