mrfirdauss commited on
Commit
f197462
1 Parent(s): 1832f24

updated typos on form

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -36,16 +36,15 @@ document_embeddings_np = document_embeddings.numpy()
36
  index = faiss.IndexFlatL2(document_embeddings_np.shape[1])
37
  index.add(document_embeddings_np)
38
 
39
- def call_gemini_api(query, context):
40
  global index
41
  k = 1
42
- D, I = index.search(embed_text(query).numpy(), k)
43
  retrieved_docs = [documents[i] for i in I[0]]
44
  gen = genai.GenerativeModel('gemini-1.5-flash')
45
  # Combine retrieved documents
46
  context = "\n\n".join(retrieved_docs)
47
- print(context)
48
- response = gen.generate_content(f'### Context:\nHere is the list of influencer that you should included on your response\n{context}' + '\n\n ### Question:\nPlease use the provided context to answer the following question comprehensively. Supplement your response with relevant knowledge. Please provide your answer with engagement rate, proposed marketing strategy and estimated budget in number. Mention relevant influencer only. Answer the question using language that used user use. Evary currency must be provided in indonesian IDR. Your strategy should related with our influencer, maybe you can give like influencer campaign scheme. You have to mention the influencer name and contact on your response. Only mention influencer from our list.\n\n### Response:\n'+ query)
49
  return response.text
50
 
51
  demo = gr.Interface(fn=call_gemini_api, inputs=["text"], outputs="text")
 
36
  index = faiss.IndexFlatL2(document_embeddings_np.shape[1])
37
  index.add(document_embeddings_np)
38
 
39
+ def call_gemini_api(productDescription, context):
40
  global index
41
  k = 1
42
+ D, I = index.search(embed_text(productDescription).numpy(), k)
43
  retrieved_docs = [documents[i] for i in I[0]]
44
  gen = genai.GenerativeModel('gemini-1.5-flash')
45
  # Combine retrieved documents
46
  context = "\n\n".join(retrieved_docs)
47
+ response = gen.generate_content(f'### Context:\nHere is the list of influencer that you should included on your response\n{context}' + '\n\n ### Question:\nPlease use the provided context to answer the following question comprehensively. Supplement your response with relevant knowledge. Please provide your answer with engagement rate, proposed marketing strategy and estimated budget in number. Mention relevant influencer only. Answer the question using language that used user use. Evary currency must be provided in indonesian IDR. Your strategy should related with our influencer, maybe you can give like influencer campaign scheme. You have to mention the influencer name and contact on your response. Only mention influencer from our list.\n\n### Response:\n'+ productDescription)
 
48
  return response.text
49
 
50
  demo = gr.Interface(fn=call_gemini_api, inputs=["text"], outputs="text")