Spaces:
Sleeping
Sleeping
replacing deepseek-r1 with llama-3.1
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import gradio as gr
|
|
| 3 |
from sentence_transformers import SentenceTransformer
|
| 4 |
import torch
|
| 5 |
from huggingface_hub import InferenceClient
|
|
|
|
| 6 |
|
| 7 |
financialText = ""
|
| 8 |
file_names = [
|
|
@@ -38,7 +39,7 @@ def getTopChunks(query, chunkEmbeddings, textChunks):
|
|
| 38 |
cleanedChunks = preprocessText(financialText)
|
| 39 |
chunkEmbeddings = createEmbeddings(cleanedChunks)
|
| 40 |
|
| 41 |
-
client =
|
| 42 |
|
| 43 |
def respond(message, history):
|
| 44 |
messages = [{"role": "system",
|
|
@@ -63,7 +64,7 @@ def respond(message, history):
|
|
| 63 |
response = ""
|
| 64 |
|
| 65 |
responseStream = client.chat_completion(
|
| 66 |
-
messages, stream = True, max_tokens =
|
| 67 |
)
|
| 68 |
|
| 69 |
for segment in responseStream:
|
|
|
|
| 3 |
from sentence_transformers import SentenceTransformer
|
| 4 |
import torch
|
| 5 |
from huggingface_hub import InferenceClient
|
| 6 |
+
from groq import Groq
|
| 7 |
|
| 8 |
financialText = ""
|
| 9 |
file_names = [
|
|
|
|
| 39 |
cleanedChunks = preprocessText(financialText)
|
| 40 |
chunkEmbeddings = createEmbeddings(cleanedChunks)
|
| 41 |
|
| 42 |
+
client = Groq(api_key = os.environ.get("SF_TOKEN"))
|
| 43 |
|
| 44 |
def respond(message, history):
|
| 45 |
messages = [{"role": "system",
|
|
|
|
| 64 |
response = ""
|
| 65 |
|
| 66 |
responseStream = client.chat_completion(
|
| 67 |
+
model = "llama-3.1-8b-instant", messages, stream = True, max_tokens = 600, temperature = 0.4
|
| 68 |
)
|
| 69 |
|
| 70 |
for segment in responseStream:
|