Kunal commited on
Commit
c2b5185
·
1 Parent(s): a190902

fixed model varibles

Browse files
Files changed (2) hide show
  1. app.py +6 -1
  2. requirements.txt +1 -0
app.py CHANGED
@@ -2,6 +2,7 @@ import gradio as gr
2
  from smolagents import LiteLLMModel, CodeAgent, tool
3
  import os
4
  from pypdf import PdfReader
 
5
 
6
  #Initialize the Model
7
  model = LiteLLMModel(
@@ -39,6 +40,11 @@ def chat_with_pdf(query: str, pdf_text: str, chat_history: list) -> str:
39
  #Agent to handle the chat with PDF
40
  agent = CodeAgent(
41
  model=model,
 
 
 
 
 
42
  tools=[process_pdf, chat_with_pdf]
43
  )
44
  #Gradio Interface
@@ -54,7 +60,6 @@ def chat_ui(query, history, pdf_text):
54
 
55
  with gr.Blocks() as demo:
56
  gr.Markdown("# PDF Chatbot")
57
-
58
  with gr.Row():
59
  pdf_input = gr.File(label="Upload PDF", file_types=[".pdf"])
60
  pdf_text = gr.Textbox(visible=False)
 
2
  from smolagents import LiteLLMModel, CodeAgent, tool
3
  import os
4
  from pypdf import PdfReader
5
+ from litellm import completion
6
 
7
  #Initialize the Model
8
  model = LiteLLMModel(
 
40
  #Agent to handle the chat with PDF
41
  agent = CodeAgent(
42
  model=model,
43
+ model_kwargs={
44
+ "model": "gemini/gemini-pro",
45
+ "api_base": "https://generativelanguage.googleapis.com/v1beta", # Correct Google API endpoint
46
+ "api_key": os.getenv("GEMINI_API_KEY") # Ensure key is set in environment
47
+ },
48
  tools=[process_pdf, chat_with_pdf]
49
  )
50
  #Gradio Interface
 
60
 
61
  with gr.Blocks() as demo:
62
  gr.Markdown("# PDF Chatbot")
 
63
  with gr.Row():
64
  pdf_input = gr.File(label="Upload PDF", file_types=[".pdf"])
65
  pdf_text = gr.Textbox(visible=False)
requirements.txt CHANGED
@@ -3,3 +3,4 @@ smolagents
3
  smolagents[litellm]
4
  pypdf
5
  gradio
 
 
3
  smolagents[litellm]
4
  pypdf
5
  gradio
6
+ litellm