andreska commited on
Commit
b739518
·
verified ·
1 Parent(s): ceaab2f

Updated to use Llama

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -14,7 +14,7 @@ file_path = "Adrega_P.I._User_Manual.docx"
14
  #pipe = pipeline("question-answering")
15
  #pipe = pipeline("text-generation")
16
  #pipe = pipeline("question-answering", model="deepset/roberta-base-squad2")
17
- pipe = pipeline("summarization", model="facebook/bart-large-cnn")
18
 
19
  st.title("Adrega AI Help")
20
  #dataset = load_dataset("andreska/adregadocs", split="test")
@@ -25,13 +25,12 @@ context = "Adrega is a very cool company, that implements AI. Rett fra Rio is a
25
  user_input = st.text_input('Ask me a question')
26
  if st.button("Submit"):
27
  if user_input:
28
- #text_inputs = f"Context: {context}\nQuestion: {user_input}\nAnswer:"
29
  #result = pipe(text_inputs, max_length=200, num_return_sequences=1)[0]['generated_text']
30
  #answer = result.split("Answer:")[1].strip()
31
  #answer = pipe(question=user_input, context=context)
32
- answer = pipe(context, max_length=512, min_length=100, do_sample=False)
33
- st.write(f"Adrega AI: {answer[0]['summary_text']}")
34
-
35
  #st.write(f"Adrega AI: {answer}")
36
  else:
37
  st.write("Please enter a question.")
 
14
  #pipe = pipeline("question-answering")
15
  #pipe = pipeline("text-generation")
16
  #pipe = pipeline("question-answering", model="deepset/roberta-base-squad2")
17
+ pipe = pipeline("text-generation", model="meta-llama/Llama-3.2-3B-Instruct")
18
 
19
  st.title("Adrega AI Help")
20
  #dataset = load_dataset("andreska/adregadocs", split="test")
 
25
  user_input = st.text_input('Ask me a question')
26
  if st.button("Submit"):
27
  if user_input:
28
+ answer = pipe(f"Context: {context}\nQuestion: {user_input}\nAnswer:", max_length=512, num_return_sequences=1)
29
  #result = pipe(text_inputs, max_length=200, num_return_sequences=1)[0]['generated_text']
30
  #answer = result.split("Answer:")[1].strip()
31
  #answer = pipe(question=user_input, context=context)
32
+
33
+ st.write(f"Adrega AI: {answer[0]['generated_text']}"
 
34
  #st.write(f"Adrega AI: {answer}")
35
  else:
36
  st.write("Please enter a question.")