RobertoBarrosoLuque commited on
Commit
6739aa3
ยท
1 Parent(s): e81f525
Files changed (1) hide show
  1. src/app.py +4 -11
src/app.py CHANGED
@@ -6,11 +6,14 @@ import os
6
  from datasets import load_dataset
7
  from PIL import Image
8
  import io
 
9
 
10
  from src.modules.vlm_inference import analyze_product_image
11
  from src.modules.data_processing import pil_to_base64
12
  from src.modules.evals import run_inference_on_dataframe
13
 
 
 
14
  # Constants
15
  AVAILABLE_MODELS = {
16
  "Qwen3-VL-30B-A3B": "accounts/fireworks/models/qwen3-vl-30b-a3b-instruct",
@@ -35,7 +38,6 @@ PROMPT_STYLES = {
35
  def analyze_single_image(
36
  image_input,
37
  model_name: str,
38
- api_key: Optional[str] = None,
39
  prompt_style_display: Optional[str] = None,
40
  ) -> tuple[str, str, str, str]:
41
  """
@@ -59,11 +61,7 @@ def analyze_single_image(
59
 
60
  # Determine provider from model name
61
  model_id = AVAILABLE_MODELS[model_name]
62
-
63
- # Get API key from environment if not provided
64
- if api_key is None:
65
- api_key = os.getenv("FIREWORKS_API_KEY")
66
-
67
  # Map display name to prompt key
68
  prompt_style = (
69
  PROMPT_STYLES.get(prompt_style_display) if prompt_style_display else None
@@ -243,10 +241,6 @@ def create_demo_interface():
243
  value="Website/Sales",
244
  label="Description Style",
245
  )
246
- api_key_input = gr.Textbox(
247
- label="API Key",
248
- type="password",
249
- )
250
 
251
  with gr.Tabs():
252
  with gr.TabItem("๐Ÿ“ธ Image Analysis ๐Ÿ“ธ "):
@@ -293,7 +287,6 @@ def create_demo_interface():
293
  inputs=[
294
  image_input,
295
  model_selector,
296
- api_key_input,
297
  prompt_selector,
298
  ],
299
  outputs=[
 
6
  from datasets import load_dataset
7
  from PIL import Image
8
  import io
9
+ from dotenv import load_dotenv
10
 
11
  from src.modules.vlm_inference import analyze_product_image
12
  from src.modules.data_processing import pil_to_base64
13
  from src.modules.evals import run_inference_on_dataframe
14
 
15
+ load_dotenv()
16
+
17
  # Constants
18
  AVAILABLE_MODELS = {
19
  "Qwen3-VL-30B-A3B": "accounts/fireworks/models/qwen3-vl-30b-a3b-instruct",
 
38
  def analyze_single_image(
39
  image_input,
40
  model_name: str,
 
41
  prompt_style_display: Optional[str] = None,
42
  ) -> tuple[str, str, str, str]:
43
  """
 
61
 
62
  # Determine provider from model name
63
  model_id = AVAILABLE_MODELS[model_name]
64
+ api_key = os.getenv("FIREWORKS_API_KEY")
 
 
 
 
65
  # Map display name to prompt key
66
  prompt_style = (
67
  PROMPT_STYLES.get(prompt_style_display) if prompt_style_display else None
 
241
  value="Website/Sales",
242
  label="Description Style",
243
  )
 
 
 
 
244
 
245
  with gr.Tabs():
246
  with gr.TabItem("๐Ÿ“ธ Image Analysis ๐Ÿ“ธ "):
 
287
  inputs=[
288
  image_input,
289
  model_selector,
 
290
  prompt_selector,
291
  ],
292
  outputs=[