shukdevdattaEX commited on
Commit
f0b9a08
·
verified ·
1 Parent(s): e841bb9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -22,7 +22,7 @@ class MultimodalChatbot:
22
  base_url="https://openrouter.ai/api/v1",
23
  api_key=api_key,
24
  )
25
- self.model = "google/gemma-2-9b-it:free" # Updated to a valid text model
26
  self.conversation_history = []
27
  # Initialize the pipeline for image-text-to-text processing
28
  try:
@@ -34,7 +34,7 @@ class MultimodalChatbot:
34
  )
35
  print("Image captioning pipeline initialized successfully")
36
  except Exception as e:
37
- print(f"Error initializing image captioning pipeline: {str(e)}")
38
  self.pipe = None
39
 
40
  def encode_image_to_base64(self, image) -> str:
@@ -257,7 +257,7 @@ class MultimodalChatbot:
257
  completion = self.client.chat.completions.create(
258
  extra_headers={
259
  "HTTP-Referer": "https://multimodal-chatbot.local",
260
- "X-Title": "Mult Mosaic Chatbot",
261
  },
262
  model=self.model,
263
  messages=messages,
@@ -525,18 +525,14 @@ def create_interface():
525
  api_key_input.change(
526
  validate_api_key,
527
  inputs=[api_key_input],
528
-  F
529
- outputs=[api_status, text_submit_btn, pdf pimodalChatbotdf_submit_btn, audio_submit_btn,
530
  image_submit_btn, video_submit_btn, combined_submit_btn]
531
  )
532
 
533
  text_submit_btn.click(
534
  process_text_input,
535
  inputs=[api_key_input, text_input, text_chatbot],
536
- outputs=[text_chatbot, text upset_btn.click(
537
- process_pdf_input,
538
- inputs=[api_key_input, pdf_input, pdf_text_input, pdf_chatbot],
539
- outputs=[pdf_chatbot, pdf_text_input]
540
  )
541
  text_input.submit(
542
  process_text_input,
 
22
  base_url="https://openrouter.ai/api/v1",
23
  api_key=api_key,
24
  )
25
+ self.model = "google/gemma-2-9b-it:free"
26
  self.conversation_history = []
27
  # Initialize the pipeline for image-text-to-text processing
28
  try:
 
34
  )
35
  print("Image captioning pipeline initialized successfully")
36
  except Exception as e:
37
+ print(f"Error initializing image captioning pipeline: {e}")
38
  self.pipe = None
39
 
40
  def encode_image_to_base64(self, image) -> str:
 
257
  completion = self.client.chat.completions.create(
258
  extra_headers={
259
  "HTTP-Referer": "https://multimodal-chatbot.local",
260
+ "X-Title": "Multimodal Chatbot",
261
  },
262
  model=self.model,
263
  messages=messages,
 
525
  api_key_input.change(
526
  validate_api_key,
527
  inputs=[api_key_input],
528
+ outputs=[api_status, text_submit_btn, pdf_submit_btn, audio_submit_btn,
 
529
  image_submit_btn, video_submit_btn, combined_submit_btn]
530
  )
531
 
532
  text_submit_btn.click(
533
  process_text_input,
534
  inputs=[api_key_input, text_input, text_chatbot],
535
+ outputs=[text_chatbot, text_input]
 
 
 
536
  )
537
  text_input.submit(
538
  process_text_input,