Spaces:
Runtime error
Runtime error
Srinivasulu kethanaboina commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,7 +3,7 @@ import os
|
|
| 3 |
from http.cookies import SimpleCookie
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
from llama_index.core import StorageContext, load_index_from_storage, VectorStoreIndex, SimpleDirectoryReader, ChatPromptTemplate, Settings
|
| 6 |
-
from llama_index.llms.
|
| 7 |
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
| 8 |
import random
|
| 9 |
import datetime
|
|
@@ -11,7 +11,7 @@ import datetime
|
|
| 11 |
# Load environment variables
|
| 12 |
load_dotenv()
|
| 13 |
|
| 14 |
-
# Configure the Llama index settings
|
| 15 |
Settings.llm = HuggingFaceInferenceAPI(
|
| 16 |
model_name="meta-llama/Meta-Llama-3-8B-Instruct",
|
| 17 |
tokenizer_name="meta-llama/Meta-Llama-3-8B-Instruct",
|
|
@@ -150,8 +150,14 @@ with gr.Blocks(css=css) as demo:
|
|
| 150 |
# Connect the button with the function, and output the status message
|
| 151 |
redirect_button.click(fn=retrieve_history_and_redirect, inputs=[], outputs=redirect_message)
|
| 152 |
|
| 153 |
-
# Add
|
| 154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
|
| 156 |
# Launch the Gradio interface
|
| 157 |
demo.launch()
|
|
|
|
| 3 |
from http.cookies import SimpleCookie
|
| 4 |
from dotenv import load_dotenv
|
| 5 |
from llama_index.core import StorageContext, load_index_from_storage, VectorStoreIndex, SimpleDirectoryReader, ChatPromptTemplate, Settings
|
| 6 |
+
from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI # Updated import
|
| 7 |
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
| 8 |
import random
|
| 9 |
import datetime
|
|
|
|
| 11 |
# Load environment variables
|
| 12 |
load_dotenv()
|
| 13 |
|
| 14 |
+
# Configure the Llama index settings with updated API
|
| 15 |
Settings.llm = HuggingFaceInferenceAPI(
|
| 16 |
model_name="meta-llama/Meta-Llama-3-8B-Instruct",
|
| 17 |
tokenizer_name="meta-llama/Meta-Llama-3-8B-Instruct",
|
|
|
|
| 150 |
# Connect the button with the function, and output the status message
|
| 151 |
redirect_button.click(fn=retrieve_history_and_redirect, inputs=[], outputs=redirect_message)
|
| 152 |
|
| 153 |
+
# Add JavaScript for redirect
|
| 154 |
+
gr.HTML("""
|
| 155 |
+
<script>
|
| 156 |
+
document.querySelector('button').addEventListener('click', function() {
|
| 157 |
+
window.location.href = 'https://redfernstech.com/chat-bot-test';
|
| 158 |
+
});
|
| 159 |
+
</script>
|
| 160 |
+
""")
|
| 161 |
|
| 162 |
# Launch the Gradio interface
|
| 163 |
demo.launch()
|