richardkimsm89 commited on
Commit
0329404
·
verified ·
1 Parent(s): 60d4859

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -3,8 +3,10 @@
3
  import gradio as gr
4
  from huggingface_hub import InferenceClient
5
 
6
- model = "meta-llama/Llama-3.2-11B-Vision-Instruct"
7
- client = InferenceClient(model)
 
 
8
 
9
  def fn_text(
10
  prompt,
@@ -21,7 +23,7 @@ def fn_text(
21
  history.append(messages[1])
22
 
23
  stream = client.chat.completions.create(
24
- model = model,
25
  messages = history,
26
  max_tokens = max_tokens,
27
  temperature = temperature,
@@ -44,7 +46,7 @@ app_text = gr.ChatInterface(
44
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-P"),
45
  ],
46
  title = "Meta Llama",
47
- description = model,
48
  )
49
 
50
  def fn_vision(
@@ -61,7 +63,7 @@ def fn_vision(
61
  messages[0]["content"].append({"type": "image_url", "image_url": {"url": image_url}})
62
 
63
  stream = client.chat.completions.create(
64
- model = model,
65
  messages = messages,
66
  max_tokens = max_tokens,
67
  temperature = temperature,
@@ -90,7 +92,7 @@ app_vision = gr.Interface(
90
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-P"),
91
  ],
92
  title = "Meta Llama",
93
- description = model,
94
  )
95
 
96
  app = gr.TabbedInterface(
 
3
  import gradio as gr
4
  from huggingface_hub import InferenceClient
5
 
6
+ model_text = "meta-llama/Llama-3.2-11B-Vision-Instruct"
7
+ model_vision = "meta-llama/Llama-3.2-11B-Vision-Instruct"
8
+
9
+ client = InferenceClient()
10
 
11
  def fn_text(
12
  prompt,
 
23
  history.append(messages[1])
24
 
25
  stream = client.chat.completions.create(
26
+ model = model_text,
27
  messages = history,
28
  max_tokens = max_tokens,
29
  temperature = temperature,
 
46
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-P"),
47
  ],
48
  title = "Meta Llama",
49
+ description = model_text,
50
  )
51
 
52
  def fn_vision(
 
63
  messages[0]["content"].append({"type": "image_url", "image_url": {"url": image_url}})
64
 
65
  stream = client.chat.completions.create(
66
+ model = model_vision,
67
  messages = messages,
68
  max_tokens = max_tokens,
69
  temperature = temperature,
 
92
  gr.Slider(minimum=0.1, maximum=1.0, value=0.95, step=0.05, label="Top-P"),
93
  ],
94
  title = "Meta Llama",
95
+ description = model_vision,
96
  )
97
 
98
  app = gr.TabbedInterface(