Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -12,7 +12,8 @@ load_dotenv()
|
|
12 |
|
13 |
# Initialize the LLM and parser
|
14 |
llm = HuggingFaceInferenceAPI(
|
15 |
-
model_name="meta-llama/Meta-Llama-3-8B-Instruct",
|
|
|
16 |
token=os.getenv("TOKEN")
|
17 |
)
|
18 |
|
@@ -45,7 +46,7 @@ def respond(message, history):
|
|
45 |
# for chr in bot_message:
|
46 |
# output += chr
|
47 |
# yield output
|
48 |
-
print(f"{datetime.now()}::message
|
49 |
return str(bot_message)
|
50 |
except Exception as e:
|
51 |
if e == "'NoneType' object has no attribute 'as_query_engine'":
|
@@ -57,7 +58,7 @@ with gr.Blocks() as demo:
|
|
57 |
with gr.Row():
|
58 |
with gr.Column(scale=1):
|
59 |
file_input = gr.File(file_count="single", type='filepath')
|
60 |
-
with gr.
|
61 |
clear = gr.ClearButton()
|
62 |
btn = gr.Button("Submit", variant='primary')
|
63 |
output = gr.Text(label='Vector Index')
|
@@ -65,7 +66,7 @@ with gr.Blocks() as demo:
|
|
65 |
gr.ChatInterface(fn=respond,
|
66 |
chatbot=gr.Chatbot(height=500),
|
67 |
textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=7),
|
68 |
-
examples=["summarize the document"]
|
69 |
)
|
70 |
|
71 |
# Action on button click to process file and load into index
|
|
|
12 |
|
13 |
# Initialize the LLM and parser
|
14 |
llm = HuggingFaceInferenceAPI(
|
15 |
+
# model_name="meta-llama/Meta-Llama-3-8B-Instruct",
|
16 |
+
model_name="mistralai/Mixtral-8x7B-Instruct-v0.1",
|
17 |
token=os.getenv("TOKEN")
|
18 |
)
|
19 |
|
|
|
46 |
# for chr in bot_message:
|
47 |
# output += chr
|
48 |
# yield output
|
49 |
+
print(f"\n{datetime.now()}::message --> {str(bot_message)}\n")
|
50 |
return str(bot_message)
|
51 |
except Exception as e:
|
52 |
if e == "'NoneType' object has no attribute 'as_query_engine'":
|
|
|
58 |
with gr.Row():
|
59 |
with gr.Column(scale=1):
|
60 |
file_input = gr.File(file_count="single", type='filepath')
|
61 |
+
with gr.Row():
|
62 |
clear = gr.ClearButton()
|
63 |
btn = gr.Button("Submit", variant='primary')
|
64 |
output = gr.Text(label='Vector Index')
|
|
|
66 |
gr.ChatInterface(fn=respond,
|
67 |
chatbot=gr.Chatbot(height=500),
|
68 |
textbox=gr.Textbox(placeholder="Ask me a yes or no question", container=False, scale=7),
|
69 |
+
# examples=["summarize the document"]
|
70 |
)
|
71 |
|
72 |
# Action on button click to process file and load into index
|