hassanelmghari commited on
Commit
2690895
·
verified ·
1 Parent(s): c2ebbce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -70,7 +70,7 @@ def bot_streaming(message, history, together_api_key, max_new_tokens=250, temper
70
 
71
  try:
72
  stream = client.chat.completions.create(
73
- model="meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo",
74
  messages=messages,
75
  max_tokens=max_new_tokens,
76
  temperature=temperature,
@@ -79,9 +79,8 @@ def bot_streaming(message, history, together_api_key, max_new_tokens=250, temper
79
 
80
  response = ""
81
  for chunk in stream:
82
- if chunk.choices and chunk.choices[0].delta and chunk.choices[0].delta.content is not None:
83
- response += chunk.choices[0].delta.content
84
- yield response
85
 
86
  if not response:
87
  yield "No response generated. Please try again."
@@ -92,7 +91,6 @@ def bot_streaming(message, history, together_api_key, max_new_tokens=250, temper
92
  else:
93
  yield f"An error occurred: {str(e)}"
94
 
95
- # The rest of your Gradio interface code remains the same
96
  with gr.Blocks() as demo:
97
  gr.Markdown("# Meta Llama-3.2-11B-Vision-Instruct (FREE)")
98
  gr.Markdown("Try the new Llama 3.2 11B Vision API by Meta for free through Together AI. Upload an image, and start chatting about it. Just paste in your Together AI API key and get started!")
 
70
 
71
  try:
72
  stream = client.chat.completions.create(
73
+ model="meta-llama/Llama-Vision-Free",
74
  messages=messages,
75
  max_tokens=max_new_tokens,
76
  temperature=temperature,
 
79
 
80
  response = ""
81
  for chunk in stream:
82
+ response += chunk.choices[0].delta.content or ""
83
+ yield response
 
84
 
85
  if not response:
86
  yield "No response generated. Please try again."
 
91
  else:
92
  yield f"An error occurred: {str(e)}"
93
 
 
94
  with gr.Blocks() as demo:
95
  gr.Markdown("# Meta Llama-3.2-11B-Vision-Instruct (FREE)")
96
  gr.Markdown("Try the new Llama 3.2 11B Vision API by Meta for free through Together AI. Upload an image, and start chatting about it. Just paste in your Together AI API key and get started!")