harriskr14 commited on
Commit
07b77ff
·
1 Parent(s): 5d5f945

Added .gitignore

Browse files
Files changed (5) hide show
  1. .env +0 -1
  2. .gitignore +1 -0
  3. __pycache__/hf_class.cpython-311.pyc +0 -0
  4. app.py +3 -4
  5. test.py +4 -0
.env DELETED
@@ -1 +0,0 @@
1
- GOOGLE_API_KEY='AIzaSyC5vclIaHLdDDOJ04bmkjmF3VGu3v1wOTQ'
 
 
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ .env
__pycache__/hf_class.cpython-311.pyc CHANGED
Binary files a/__pycache__/hf_class.cpython-311.pyc and b/__pycache__/hf_class.cpython-311.pyc differ
 
app.py CHANGED
@@ -2,7 +2,6 @@ from PIL import Image
2
  from io import BytesIO
3
  from google import genai
4
  from google.genai import types
5
- from dotenv import load_dotenv
6
  from transforms import transform, target_transform
7
  from torchvision import models
8
  from hf_class import MyResNet18
@@ -11,8 +10,6 @@ import torch.nn.functional as F
11
  import os
12
  import gradio as gr
13
 
14
- load_dotenv()
15
-
16
  index_to_label = {
17
  0: 'battery',
18
  1: 'biological',
@@ -40,7 +37,9 @@ def predict_image(img: Image):
40
  predicted_label = index_to_label[preds.item()]
41
  confidence_score = float('{:.4f}'.format(softmax[0][preds.item()].item()))
42
 
43
- client = genai.Client(api_key=os.getenv('GOOGLE_API_KEY'))
 
 
44
 
45
  if predicted_label != 'trash':
46
  response = client.models.generate_content(
 
2
  from io import BytesIO
3
  from google import genai
4
  from google.genai import types
 
5
  from transforms import transform, target_transform
6
  from torchvision import models
7
  from hf_class import MyResNet18
 
10
  import os
11
  import gradio as gr
12
 
 
 
13
  index_to_label = {
14
  0: 'battery',
15
  1: 'biological',
 
37
  predicted_label = index_to_label[preds.item()]
38
  confidence_score = float('{:.4f}'.format(softmax[0][preds.item()].item()))
39
 
40
+ google_api_key = os.environ.get('GOOGLE_API_KEY')
41
+
42
+ client = genai.Client(api_key=google_api_key)
43
 
44
  if predicted_label != 'trash':
45
  response = client.models.generate_content(
test.py ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ import os
2
+
3
+ api_key = os.environ.get("GOOGLE_API_KEY")
4
+ print(api_key)