Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,13 +2,13 @@ import streamlit as st
|
|
2 |
import requests
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
|
5 |
-
# Load the Llama
|
6 |
-
model_name = "
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
8 |
model = AutoModelForCausalLM.from_pretrained(model_name)
|
9 |
|
10 |
def search_api_call(query: str):
|
11 |
-
api_key = '614e992d87c496fb15a81a2039e00e6a42530f5c' # Replace with your actual API key
|
12 |
url = f"https://api.serper.dev/search?api_key={api_key}&q={query}"
|
13 |
|
14 |
try:
|
@@ -50,7 +50,7 @@ if st.button("Submit"):
|
|
50 |
combined_response = llm_response # Fallback to the original LLM response
|
51 |
else:
|
52 |
combined_response = llm_response
|
53 |
-
|
54 |
st.markdown("### Response:")
|
55 |
st.markdown(combined_response)
|
56 |
|
|
|
2 |
import requests
|
3 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
4 |
|
5 |
+
# Load the Llama model and tokenizer (replace with actual model name in Hugging Face Model Hub)
|
6 |
+
model_name = "meta-llama/Llama-3.2" # Adjust to the actual model path if needed
|
7 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
8 |
model = AutoModelForCausalLM.from_pretrained(model_name)
|
9 |
|
10 |
def search_api_call(query: str):
|
11 |
+
api_key = '614e992d87c496fb15a81a2039e00e6a42530f5c' # Replace with your actual Serper.dev API key
|
12 |
url = f"https://api.serper.dev/search?api_key={api_key}&q={query}"
|
13 |
|
14 |
try:
|
|
|
50 |
combined_response = llm_response # Fallback to the original LLM response
|
51 |
else:
|
52 |
combined_response = llm_response
|
53 |
+
|
54 |
st.markdown("### Response:")
|
55 |
st.markdown(combined_response)
|
56 |
|