raflibagas commited on
Commit
a8eb8ad
·
verified ·
1 Parent(s): 14b9f3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -8,20 +8,15 @@ from langchain_groq import ChatGroq
8
  import gradio as gr
9
 
10
  # Initialize Groq
11
- # llm = ChatGroq(
12
- # api_key=os.environ.get("GROQ_API_KEY"),
13
- # model_name="deepseek-r1-distill-llama-70b"
14
- # )
15
-
16
  llm = ChatGroq(
17
- api_key=os.environ.get("GROQ_API_KEY"),
18
- model_name="mixtral-8x7b-32768"
19
  )
20
 
21
  def create_rag_system():
22
  try:
23
  # 1. Load Documents
24
- pdf_loader = PyPDFLoader("smarthome_hub_documentation.pdf")
25
  pdf_docs = pdf_loader.load()
26
 
27
  # 2. Split Documents
@@ -63,7 +58,9 @@ def respond(message, history):
63
  )
64
 
65
  # Get response
66
- response = qa_chain.run(message)
 
 
67
  return response
68
  except Exception as e:
69
  return f"An error occurred: {str(e)}"
 
8
  import gradio as gr
9
 
10
  # Initialize Groq
 
 
 
 
 
11
  llm = ChatGroq(
12
+ api_key="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",
13
+ model_name="llama-3.1-8b-instant"
14
  )
15
 
16
  def create_rag_system():
17
  try:
18
  # 1. Load Documents
19
+ pdf_loader = PyPDFLoader("smarthome_hub_documentation_Final.pdf")
20
  pdf_docs = pdf_loader.load()
21
 
22
  # 2. Split Documents
 
58
  )
59
 
60
  # Get response
61
+
62
+ rag_prompt = f"""Jawablah pertanyaan berikut dalam Bahasa Indonesia: {message}"""
63
+ response = qa_chain.run(rag_prompt)
64
  return response
65
  except Exception as e:
66
  return f"An error occurred: {str(e)}"