Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,24 +1,29 @@
|
|
1 |
import os
|
2 |
-
import logging
|
3 |
-
import streamlit as st
|
4 |
-
from huggingface_hub import hf_hub_download
|
5 |
-
from llama_cpp import Llama
|
6 |
-
from llama_cpp_agent.providers import LlamaCppPythonProvider
|
7 |
-
from llama_cpp_agent import LlamaCppAgent, MessagesFormatterType
|
8 |
-
from llama_cpp_agent.chat_history import BasicChatHistory
|
9 |
-
from llama_cpp_agent.chat_history.messages import Roles
|
10 |
-
from llama_cpp_agent.llm_output_settings import (
|
11 |
-
LlmStructuredOutputSettings,
|
12 |
-
LlmStructuredOutputType,
|
13 |
-
)
|
14 |
-
from llama_cpp_agent.tools import WebSearchTool
|
15 |
-
from llama_cpp_agent.prompt_templates import web_search_system_prompt, research_system_prompt
|
16 |
-
from utils import CitingSources
|
17 |
-
from settings import get_context_by_model, get_messages_formatter_type
|
18 |
|
19 |
# Install necessary libraries using os.system
|
20 |
os.system("pip install streamlit llama-cpp-agent huggingface_hub")
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
# Download the models
|
23 |
hf_hub_download(
|
24 |
repo_id="bartowski/Mistral-7B-Instruct-v0.3-GGUF",
|
|
|
1 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
# Install necessary libraries using os.system
|
4 |
os.system("pip install streamlit llama-cpp-agent huggingface_hub")
|
5 |
|
6 |
+
try:
|
7 |
+
from llama_cpp import Llama
|
8 |
+
from llama_cpp_agent.providers import LlamaCppPythonProvider
|
9 |
+
from llama_cpp_agent import LlamaCppAgent, MessagesFormatterType
|
10 |
+
from llama_cpp_agent.chat_history import BasicChatHistory
|
11 |
+
from llama_cpp_agent.chat_history.messages import Roles
|
12 |
+
from llama_cpp_agent.llm_output_settings import (
|
13 |
+
LlmStructuredOutputSettings,
|
14 |
+
LlmStructuredOutputType,
|
15 |
+
)
|
16 |
+
from llama_cpp_agent.tools import WebSearchTool
|
17 |
+
from llama_cpp_agent.prompt_templates import web_search_system_prompt, research_system_prompt
|
18 |
+
from utils import CitingSources
|
19 |
+
from settings import get_context_by_model, get_messages_formatter_type
|
20 |
+
except ImportError as e:
|
21 |
+
raise ImportError(f"Error importing modules: {e}")
|
22 |
+
|
23 |
+
import logging
|
24 |
+
import streamlit as st
|
25 |
+
from huggingface_hub import hf_hub_download
|
26 |
+
|
27 |
# Download the models
|
28 |
hf_hub_download(
|
29 |
repo_id="bartowski/Mistral-7B-Instruct-v0.3-GGUF",
|