rishabh5752 commited on
Commit
840f0b5
Β·
1 Parent(s): 3589819

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -1
app.py CHANGED
@@ -1,4 +1,3 @@
1
- pip install duckduckgo-search
2
  import gradio as gr
3
  import chainlit as cl
4
  from langchain import OpenAI, LLMChain
@@ -16,6 +15,14 @@ from main1 import predict
16
  from PIL import Image
17
  import io
18
 
 
 
 
 
 
 
 
 
19
  OPENAI_API_KEY = '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'
20
 
21
  search = DuckDuckGoSearchRun()
 
 
1
  import gradio as gr
2
  import chainlit as cl
3
  from langchain import OpenAI, LLMChain
 
15
  from PIL import Image
16
  import io
17
 
18
+ # Attempt to install the 'duckduckgo-search' package if not already installed
19
+ try:
20
+ import duckduckgo_search
21
+ except ImportError:
22
+ import subprocess
23
+ subprocess.call(["pip", "install", "duckduckgo-search"])
24
+ import duckduckgo_search
25
+
26
  OPENAI_API_KEY = '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'
27
 
28
  search = DuckDuckGoSearchRun()