Madhuri123 commited on
Commit
d04a492
·
verified ·
1 Parent(s): a00b455

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -15,14 +15,17 @@ model_id = st.selectbox(
15
  "Select a LLaMA model",
16
  ["meta-llama/Llama-3.2-3B-Instruct", "meta-llama/Llama-3.2-1B-Instruct"] # Replace with the correct model names
17
  )
18
- client = InferenceClient(model=model_id,token=hf_token)
 
 
19
 
20
  # Button to trigger the inference
21
  if st.button("Generate Text"):
22
  if user_input:
23
  with st.spinner(f"Generating text using {model_id}..."):
24
  # Perform inference using the selected model
25
- response = client.text_generation(model=
 
26
  messages=[
27
  {"role": "system", "content": "You are a question answering assistant."},
28
  {"role": "user", "content": user_input}
@@ -35,3 +38,5 @@ if st.button("Generate Text"):
35
  else:
36
  st.warning("Please enter a prompt to generate text.")
37
 
 
 
 
15
  "Select a LLaMA model",
16
  ["meta-llama/Llama-3.2-3B-Instruct", "meta-llama/Llama-3.2-1B-Instruct"] # Replace with the correct model names
17
  )
18
+
19
+ # Initialize the Inference Client
20
+ client = InferenceClient(token=hf_token)
21
 
22
  # Button to trigger the inference
23
  if st.button("Generate Text"):
24
  if user_input:
25
  with st.spinner(f"Generating text using {model_id}..."):
26
  # Perform inference using the selected model
27
+ response = client.text_generation(
28
+ model=model_id,
29
  messages=[
30
  {"role": "system", "content": "You are a question answering assistant."},
31
  {"role": "user", "content": user_input}
 
38
  else:
39
  st.warning("Please enter a prompt to generate text.")
40
 
41
+
42
+