santoshNA commited on
Commit
5b0eee7
1 Parent(s): c6a3fa6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -7,6 +7,7 @@ import streamlit as st
7
 
8
  HF_API_KEY=st.secrets["HF_API_KEY"]
9
  OpenAI_API_Key=st.secrets["OPENAI_API_KEY"]
 
10
 
11
  # img2text
12
  def img2text(url):
@@ -27,7 +28,7 @@ def generate_description(caption):
27
 
28
  prompt = PromptTemplate(template=template, input_variables=["caption"])
29
 
30
- desc_llm = LLMChain(llm=OpenAI(model_name="gpt-4-1106-preview", temperature=1,api_key=OpenAI_API_Key), prompt=prompt, verbose=True)
31
  description = desc_llm.predict(caption=caption).replace('"', '')
32
 
33
  print(description)
 
7
 
8
  HF_API_KEY=st.secrets["HF_API_KEY"]
9
  OpenAI_API_Key=st.secrets["OPENAI_API_KEY"]
10
+ openai_instance = OpenAI(api_key=OpenAI_API_Key)
11
 
12
  # img2text
13
  def img2text(url):
 
28
 
29
  prompt = PromptTemplate(template=template, input_variables=["caption"])
30
 
31
+ desc_llm = LLMChain(llm=openai_instance, prompt=prompt, verbose=True)
32
  description = desc_llm.predict(caption=caption).replace('"', '')
33
 
34
  print(description)