Spaces:
Runtime error
Runtime error
acecalisto3
commited on
Commit
•
d8076e1
1
Parent(s):
b306f7e
Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,9 @@ from selenium.webdriver.support.ui import WebDriverWait
|
|
13 |
from selenium.webdriver.support import expected_conditions as EC
|
14 |
from selenium.webdriver.common.keys import Keys
|
15 |
from selenium.common.exceptions import NoSuchElementException
|
16 |
-
|
17 |
-
from transformers import pipeline
|
18 |
import feedparser
|
|
|
19 |
|
20 |
# Configure logging
|
21 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
@@ -111,11 +111,14 @@ def display_csv(url):
|
|
111 |
|
112 |
# Define the chat response function using the Mistral model
|
113 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
119 |
|
120 |
# Function to generate RSS feed for a given URL
|
121 |
def generate_rss_feed(url):
|
|
|
13 |
from selenium.webdriver.support import expected_conditions as EC
|
14 |
from selenium.webdriver.common.keys import Keys
|
15 |
from selenium.common.exceptions import NoSuchElementException
|
16 |
+
import requests
|
|
|
17 |
import feedparser
|
18 |
+
import gradio as gr
|
19 |
|
20 |
# Configure logging
|
21 |
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
111 |
|
112 |
# Define the chat response function using the Mistral model
|
113 |
def respond(message, history, system_message, max_tokens, temperature, top_p):
|
114 |
+
API_URL = "https://api-inference.huggingface.co/models/mistralai/Mixtral-8x7B-Instruct-v0.1"
|
115 |
+
headers = {"Authorization": f"Bearer {os.getenv('HF_API_TOKEN')}"}
|
116 |
+
payload = {
|
117 |
+
"inputs": f"User: {message}\nHistory: {history}\nSystem: {system_message}",
|
118 |
+
"parameters": {"max_length": max_tokens, "temperature": temperature, "top_p": top_p},
|
119 |
+
}
|
120 |
+
response = requests.post(API_URL, headers=headers, json=payload)
|
121 |
+
return response.json()[0]["generated_text"]
|
122 |
|
123 |
# Function to generate RSS feed for a given URL
|
124 |
def generate_rss_feed(url):
|