Spaces:
Runtime error
Runtime error
Threatthriver
commited on
Commit
•
cea70da
1
Parent(s):
1ba4597
Update app.py
Browse files
app.py
CHANGED
@@ -2,12 +2,18 @@ import gradio as gr
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
from bs4 import BeautifulSoup
|
4 |
import requests
|
|
|
5 |
from typing import List, Tuple, Optional
|
6 |
|
|
|
|
|
|
|
|
|
|
|
7 |
# Initialize the InferenceClient with the specified model and API key
|
8 |
client = InferenceClient(
|
9 |
model="meta-llama/Meta-Llama-3.1-405B-Instruct",
|
10 |
-
token=
|
11 |
)
|
12 |
|
13 |
def scrape_yahoo_search(query: str, num_results: int = 3) -> Tuple[str, str]:
|
|
|
2 |
from huggingface_hub import InferenceClient
|
3 |
from bs4 import BeautifulSoup
|
4 |
import requests
|
5 |
+
import os
|
6 |
from typing import List, Tuple, Optional
|
7 |
|
8 |
+
# Retrieve API key from environment variable
|
9 |
+
api_key = os.getenv('HFTOKEN')
|
10 |
+
if not api_key:
|
11 |
+
raise ValueError("API key not found. Please set the HFTOKEN environment variable.")
|
12 |
+
|
13 |
# Initialize the InferenceClient with the specified model and API key
|
14 |
client = InferenceClient(
|
15 |
model="meta-llama/Meta-Llama-3.1-405B-Instruct",
|
16 |
+
token=api_key
|
17 |
)
|
18 |
|
19 |
def scrape_yahoo_search(query: str, num_results: int = 3) -> Tuple[str, str]:
|